mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
This commit is contained in:
parent
5ebff7b300
commit
f4934ea77d
21 changed files with 120 additions and 75 deletions
|
@ -2395,7 +2395,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
add_dict++;
|
||||
}
|
||||
if (PyUnicode_CompareWithASCIIString(tmp, "__weakref__") == 0) {
|
||||
if (_PyUnicode_EqualToASCIIString(tmp, "__weakref__")) {
|
||||
if (!may_add_weak || add_weak) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"__weakref__ slot disallowed: "
|
||||
|
@ -2419,7 +2419,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
if ((add_dict &&
|
||||
_PyUnicode_CompareWithId(tmp, &PyId___dict__) == 0) ||
|
||||
(add_weak &&
|
||||
PyUnicode_CompareWithASCIIString(tmp, "__weakref__") == 0))
|
||||
_PyUnicode_EqualToASCIIString(tmp, "__weakref__")))
|
||||
continue;
|
||||
tmp =_Py_Mangle(name, tmp);
|
||||
if (!tmp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue