Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Default expr_context parameters in ast to Load() #118851

Copy link
Copy link
Closed
@JelleZijlstra

Description

@JelleZijlstra
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

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixesbugs and 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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.