Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update a TODO comment.
  • Loading branch information
ericsnowcurrently committed May 30, 2023
commit f4a5da1c3725c449a6223922a92e8d17bc8a8425
4 changes: 2 additions & 2 deletions Include/internal/pycore_typeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ typedef struct {
PyTypeObject *type;
int readying;
int ready;
// XXX tp_dict, tp_bases, and tp_mro can probably be statically
// allocated, instead of dynamically and stored on the interpreter.
// XXX tp_dict can probably be statically allocated,
// instead of dynamically and stored on the interpreter.
PyObject *tp_dict;
PyObject *tp_subclasses;
/* We never clean up weakrefs for static builtin types since
Expand Down
4 changes: 4 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ set_tp_bases(PyTypeObject *self, PyObject *bases)
{
assert(PyTuple_CheckExact(bases));
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
// XXX tp_bases can probably be statically allocated for each
// static builtin type.
assert(_Py_IsMainInterpreter(_PyInterpreterState_GET()));
assert(self->tp_bases == NULL);
if (PyTuple_GET_SIZE(bases) == 0) {
Expand Down Expand Up @@ -335,6 +337,8 @@ set_tp_mro(PyTypeObject *self, PyObject *mro)
{
assert(PyTuple_CheckExact(mro));
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
// XXX tp_mro can probably be statically allocated for each
// static builtin type.
assert(_Py_IsMainInterpreter(_PyInterpreterState_GET()));
assert(self->tp_mro == NULL);
/* Other checks are done via set_tp_bases. */
Expand Down