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:
Eric Snow 2023-04-27 16:19:43 -06:00 committed by GitHub
parent 56c7176d1d
commit d2e2e53f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 89 additions and 169 deletions

View file

@ -6351,19 +6351,9 @@ PyLong_GetInfo(void)
PyStatus
_PyLong_InitTypes(PyInterpreterState *interp)
{
if (!_Py_IsMainInterpreter(interp)) {
return _PyStatus_OK();
}
if (PyType_Ready(&PyLong_Type) < 0) {
return _PyStatus_ERR("Can't initialize int type");
}
/* initialize int_info */
if (Int_InfoType.tp_name == NULL) {
if (_PyStructSequence_InitBuiltin(&Int_InfoType, &int_info_desc) < 0) {
return _PyStatus_ERR("can't init int info type");
}
if (_PyStructSequence_InitBuiltin(&Int_InfoType, &int_info_desc) < 0) {
return _PyStatus_ERR("can't init int info type");
}
return _PyStatus_OK();