mirror of
https://github.com/python/cpython.git
synced 2026-05-13 22:11:05 +00:00
[3.14] gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178) (#144227)
gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178)
(cherry picked from commit 639c1ad4f1)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
ca6142dae9
commit
7ae9a479cf
4 changed files with 36 additions and 6 deletions
6
Python/Python-ast.c
generated
6
Python/Python-ast.c
generated
|
|
@ -5226,7 +5226,7 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
|||
}
|
||||
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);
|
||||
res = -1;
|
||||
goto cleanup;
|
||||
|
|
@ -5249,7 +5249,7 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
|
|||
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
|
||||
|
|
@ -5491,7 +5491,7 @@ ast_type_replace_check(PyObject *self,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue