8000 gh-117482: Fix Builtin Types Slot Wrappers When Embedded by ericsnowcurrently · Pull Request #121636 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117482: Fix Builtin Types Slot Wrappers When Embedded #121636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev Previous commit
Merge branch 'main' into fix-builtin-slot-wrappers-embedded
  • Loading branch information
ericsnowcurrently committed Aug 12, 2024
commit 631bf66ab020155a32d01a407fc3904aec6d6252
23 changes: 23 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,29 @@ managed_static_type_state_clear(PyInterpreterState *interp, PyTypeObject *self,
}
}


PyObject *
_PyStaticType_GetBuiltins(void)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
Py_ssize_t count = (Py_ssize_t)interp->types.builtins.num_initialized;
assert(count <= _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES);

PyObject *results = PyList_New(count);
if (results == NULL) {
return NULL;
}
for (Py_ssize_t i = 0; i < count; i++) {
PyTypeObject *cls = interp->types.builtins.initialized[i].type;
assert(cls != NULL);
assert(interp->types.builtins.initialized[i].isbuiltin);
PyList_SET_ITEM(results, i, Py_NewRef((PyObject *)cls));
}

return results;
}


// Also see _PyStaticType_InitBuiltin() and _PyStaticType_FiniBuiltin().

/* end static builtin helpers */
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0