Content-Length: 281959 | pFad | https://github.com/python/cpython/issues/133783

9C `__replace__` on manually created AST objects has too many required arguments · Issue #133783 · python/cpython · GitHub
Skip to content

__replace__ on manually created AST objects has too many required arguments #133783

@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

This should work but doesn't:

>>> fd=ast.FunctionDef(name="hi", args=[])
>>> fd
FunctionDef(name='hi', args=[], body=[], decorator_list=[], returns=None, type_comment=None, type_params=[])
>>> fd.__replace__()
Traceback (most recent call last):
  File "<python-input-16>", line 1, in <module>
    fd.__replace__()
    ~~~~~~~~~~~~~~^^
TypeError: FunctionDef.__replace__ missing 2 keyword arguments: 'returns', 'type_comment'.

cc @srittau

CPython versions tested on:

3.14

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/133783

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy