Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-144169: Fix three crashes in AST objects with non-str kwargs#144178

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 2 commits intopython:mainfromJelleZijlstra:ast-str-kwarg
Jan 26, 2026

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commentedJan 23, 2026
edited by bedevere-appbot
Loading

@vstinner
Copy link
Member

I closed my PR#144177 since this one is more complete.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. I just left minor suggestions.

Comment on lines +945 to 946
"%.400s got multiple values for argument%R",
Py_TYPE(self)->tp_name, key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Since we are modifying the error message, you must use the safer%T format:

Suggested change
"%.400s got multiple values for argument %R",
Py_TYPE(self)->tp_name,key);
"%T got multiple values for argument %R",
self,key);

Same remark for the two other changes below.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It looks like this changes the error message to include the module name:

$ python3.14 -Wall -c 'import ast; ast.Name(idx=3)'<string>:1: DeprecationWarning: Name.__init__ got an unexpected keyword argument 'idx'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.<string>:1: DeprecationWarning: Name.__init__ missing 1 required positional argument: 'id'. This will become an error in Python 3.15.$ ./python.exe -Wall -c 'import ast; ast.Name(idx=3)'<string>:1: DeprecationWarning: ast.Name.__init__ got an unexpected keyword argument 'idx'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.<string>:1: DeprecationWarning: ast.Name.__init__ missing 1 required positional argument: 'id'. This will become an error in Python 3.15.

I feel like that's a change we should only make in 3.15, not in the bugfix releases.

Why is %T safer?

Co-authored-by: Victor Stinner <vstinner@python.org>
@JelleZijlstraJelleZijlstra merged commit639c1ad intopython:mainJan 26, 2026
47 checks passed
@miss-islington-app
Copy link

Thanks@JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@JelleZijlstraJelleZijlstra deleted the ast-str-kwarg branchJanuary 26, 2026 01:29
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJan 26, 2026
…pythonGH-144178)(cherry picked from commit639c1ad)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@miss-islington-app
Copy link

Sorry,@JelleZijlstra, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker 639c1ad4f1ef5c2409a62fa8ed16e6aa3a6f9ab8 3.13

@bedevere-app
Copy link

GH-144227 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelJan 26, 2026
vstinner added a commit that referenced this pull requestJan 26, 2026
GH-144178) (#144227)gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178)(cherry picked from commit639c1ad)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
Copy link
Member

@JelleZijlstra: Do you want to try backporting the change manually to 3.13?

@bedevere-app
Copy link

GH-144260 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJan 27, 2026
JelleZijlstra added a commit that referenced this pull requestJan 28, 2026
GH-144178) (#144260)(cherry picked from commit639c1ad)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

@Eclips4Eclips4Eclips4 approved these changes

@pablogsalpablogsalAwaiting requested review from pablogsalpablogsal is a code owner

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

@tomasr8tomasr8Awaiting requested review from tomasr8tomasr8 is a code owner

Assignees

@JelleZijlstraJelleZijlstra

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@JelleZijlstra@vstinner@Eclips4

[8]ページ先頭

©2009-2026 Movatter.jp