mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
bpo-38113: Update Python/ast.c to PEP-384 (GH-15975)
Removes statics for better subinterpreter support and moves to _PyType_Name https://bugs.python.org/issue38113 Automerge-Triggered-By: @tiran
This commit is contained in:
parent
0cc27417f2
commit
5b172c27f7
1 changed files with 3 additions and 4 deletions
|
|
@ -294,7 +294,7 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
|
||||||
if (!validate_constant(exp->v.Constant.value)) {
|
if (!validate_constant(exp->v.Constant.value)) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"got an invalid type in Constant: %s",
|
"got an invalid type in Constant: %s",
|
||||||
Py_TYPE(exp->v.Constant.value)->tp_name);
|
_PyType_Name(Py_TYPE(exp->v.Constant.value)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -618,12 +618,11 @@ new_identifier(const char *n, struct compiling *c)
|
||||||
identifier; if so, normalize to NFKC. */
|
identifier; if so, normalize to NFKC. */
|
||||||
if (!PyUnicode_IS_ASCII(id)) {
|
if (!PyUnicode_IS_ASCII(id)) {
|
||||||
PyObject *id2;
|
PyObject *id2;
|
||||||
_Py_IDENTIFIER(NFKC);
|
|
||||||
if (!c->c_normalize && !init_normalization(c)) {
|
if (!c->c_normalize && !init_normalization(c)) {
|
||||||
Py_DECREF(id);
|
Py_DECREF(id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
PyObject *form = _PyUnicode_FromId(&PyId_NFKC);
|
PyObject *form = PyUnicode_InternFromString("NFKC");
|
||||||
if (form == NULL) {
|
if (form == NULL) {
|
||||||
Py_DECREF(id);
|
Py_DECREF(id);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -637,7 +636,7 @@ new_identifier(const char *n, struct compiling *c)
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"unicodedata.normalize() must return a string, not "
|
"unicodedata.normalize() must return a string, not "
|
||||||
"%.200s",
|
"%.200s",
|
||||||
Py_TYPE(id2)->tp_name);
|
_PyType_Name(Py_TYPE(id2)));
|
||||||
Py_DECREF(id2);
|
Py_DECREF(id2);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue