Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105858: Improve AST node constructors #105880

Merged
merged 18 commits into from
Feb 28, 2024
Merged

Commits on Jun 17, 2023

  1. pythongh-105858: Improve AST node constructors

    Demonstration:
    
    >>> ast.FunctionDef.__annotations__
    {'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]}
    >>> ast.FunctionDef()
    <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15.
    <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15.
    <ast.FunctionDef object at 0x101959460>
    >>> node = ast.FunctionDef(name="foo", args=ast.arguments())
    >>> node.decorator_list
    []
    >>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments())
    <stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.
    <ast.FunctionDef object at 0x1019581f0>
    
    Known problems:
    - Subclasses of AST nodes don't work properly, because we don't look up __annotations__ on the
      right class.
    - Unpickling throws DeprecationWarnings, probably because of how we construct the unpickled
      object.
    
    Need to think more about how to handle those cases.
    JelleZijlstra committed Jun 17, 2023
    Configuration menu
    Copy the full SHA
    b1b73d9 View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2023

  1. Configuration menu
    Copy the full SHA
    d417cf3 View commit details
    Browse the repository at this point in the history
  2. Fix subclasses

    JelleZijlstra committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    c74740a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    05d5569 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    f4b14ac View commit details
    Browse the repository at this point in the history
  2. Fix renamed function

    JelleZijlstra committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    0efcdf3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f941696 View commit details
    Browse the repository at this point in the history
  4. Fix other refleak

    JelleZijlstra committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    4c42748 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Configuration menu
    Copy the full SHA
    1a9b872 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2024

  1. Configuration menu
    Copy the full SHA
    db16cc7 View commit details
    Browse the repository at this point in the history
  2. Update Parser/asdl_c.py

    JelleZijlstra committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    6bf677b View commit details
    Browse the repository at this point in the history
  3. fix merge

    JelleZijlstra committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    a2442b6 View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. Expand NEWS

    JelleZijlstra committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    5a1d37a View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2024

  1. Configuration menu
    Copy the full SHA
    c4627a1 View commit details
    Browse the repository at this point in the history
  2. docs

    JelleZijlstra committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    1f85438 View commit details
    Browse the repository at this point in the history
  3. Apply suggestions from code review

    Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
    JelleZijlstra and AlexWaygood committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    ff0cc67 View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

  1. Configuration menu
    Copy the full SHA
    54cf55f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4bb0656 View commit details
    Browse the repository at this point in the history