-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Fix three crashes when non-string keyword arguments are supplied to objects | ||
| in the :mod:`ast` module. |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -942,7 +942,7 @@ def visitModule(self, mod): | |||||||||
| } | ||||||||||
| if (p == 0) { | ||||||||||
| PyErr_Format(PyExc_TypeError, | ||||||||||
| "%.400s got multiple values for argument '%U'", | ||||||||||
| "%.400s got multiple values for argument %R", | ||||||||||
| Py_TYPE(self)->tp_name, key); | ||||||||||
|
Comment on lines
+945
to
946
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are modifying the error message, you must use the safer
Suggested change
Same remark for the two other changes below.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: I feel like that's a change we should only make in 3.15, not in the bugfix releases. Why is %T safer? |
||||||||||
| res = -1; | ||||||||||
| goto cleanup; | ||||||||||
|
|
@@ -965,7 +965,7 @@ def visitModule(self, mod): | |||||||||
| else if (contains == 0) { | ||||||||||
| if (PyErr_WarnFormat( | ||||||||||
| PyExc_DeprecationWarning, 1, | ||||||||||
| "%.400s.__init__ got an unexpected keyword argument '%U'. " | ||||||||||
| "%.400s.__init__ got an unexpected keyword argument %R. " | ||||||||||
| "Support for arbitrary keyword arguments is deprecated " | ||||||||||
| "and will be removed in Python 3.15.", | ||||||||||
| Py_TYPE(self)->tp_name, key | ||||||||||
|
|
@@ -1207,7 +1207,7 @@ def visitModule(self, mod): | |||||||||
| if (rc == 0) { | ||||||||||
| PyErr_Format(PyExc_TypeError, | ||||||||||
| "%.400s.__replace__ got an unexpected keyword " | ||||||||||
| "argument '%U'.", Py_TYPE(self)->tp_name, key); | ||||||||||
| "argument %R.", Py_TYPE(self)->tp_name, key); | ||||||||||
| Py_DECREF(expecting); | ||||||||||
| return -1; | ||||||||||
| } | ||||||||||
|
|
||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.