mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)
There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
This commit is contained in:
parent
56c7176d1d
commit
d2e2e53f73
21 changed files with 89 additions and 169 deletions
|
|
@ -890,7 +890,7 @@ PyObject_Hash(PyObject *v)
|
|||
* an explicit call to PyType_Ready, we implicitly call
|
||||
* PyType_Ready here and then check the tp_hash slot again
|
||||
*/
|
||||
if (tp->tp_dict == NULL) {
|
||||
if (!_PyType_IsReady(tp)) {
|
||||
if (PyType_Ready(tp) < 0)
|
||||
return -1;
|
||||
if (tp->tp_hash != NULL)
|
||||
|
|
@ -1385,7 +1385,7 @@ _PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name,
|
|||
}
|
||||
Py_INCREF(name);
|
||||
|
||||
if (tp->tp_dict == NULL) {
|
||||
if (!_PyType_IsReady(tp)) {
|
||||
if (PyType_Ready(tp) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1507,8 +1507,9 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (tp->tp_dict == NULL && PyType_Ready(tp) < 0)
|
||||
if (!_PyType_IsReady(tp) && PyType_Ready(tp) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Py_INCREF(name);
|
||||
Py_INCREF(tp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue