GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Default expr_context parameters in ast to Load() · Issue #118851 · python/cpython

Default expr_context parameters in ast to Load() #118851

New issue
Copy link
New issue
Copy link
Closed
Closed
Default expr_context parameters in ast to Load()#118851
Copy link
Assignees
JelleZijlstra
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestype-featureA feature request or enhancementA feature request or enhancement

Description

@JelleZijlstra
JelleZijlstra
opened on May 9, 2024
Issue body actions

Feature or enhancement

Proposal:

In #105858, we changed the AST node constructors to raise a DeprecationWarning when any required fields are omitted. Optional fields default to None and list fields default to an empty list. In real-world usage, it emerges that it's often also useful to omit the ctx argument to various classes (Attribute, Subscript, Starred, Name, List, Tuple); its value often does not matter, and it's convenient to have it default to ast.Load().

I'd like to backport this to 3.13 since it helps undo a noisy DeprecationWarning.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

python/typeshed#11880 (comment)

Linked PRs

  • gh-118851: Default ctx arguments to AST constructors to Load() #118854
  • [3.13] gh-118851: Default ctx arguments to AST constructors to Load() (GH-118854) #118871
Reacted by Alex Waygood

Activity

  1. JelleZijlstra
    added
    type-featureA feature request or enhancementA feature request or enhancement
    3.13only security fixesonly security fixes
    3.14bugs and security fixesbugs and security fixes
    on May 9, 2024
  2. JelleZijlstra
    self-assigned this
    on May 9, 2024
  3. JelleZijlstra
    added 2 commits that reference this issue on May 9, 2024

    pythongh-118851: Default ctx arguments to AST constructors to Load()

    83d76cd

    gh-118851: Default ctx arguments to AST constructors to Load() (#118854)

    68fbc00
  4. miss-islington
    added a commit that references this issue on May 9, 2024

    pythongh-118851: Default ctx arguments to AST constructors to Load() (p…

    a316822
  5. JelleZijlstra
    added a commit that references this issue on May 9, 2024

    [3.13] gh-118851: Default ctx arguments to AST constructors to Load() (…

    00ec116
  6. AlexWaygood
    closed this as completedon May 10, 2024
  7. SonicField
    added a commit that references this issue on May 10, 2024

    pythongh-118851: Default ctx arguments to AST constructors to Load() (p…

    bb8677d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @JelleZijlstra
    JelleZijlstra

Labels

3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.