mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +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:
commit
3b73ea1278
22 changed files with 125 additions and 80 deletions
|
@ -2412,7 +2412,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: "
|
||||
|
@ -2436,7 +2436,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