diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-05-02 02:34:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 02:34:43 (GMT) |
commit | f73abf8e03fd370c86fbb2a249fe1e065f7d84b4 (patch) | |
tree | fb471d3aafd99ade5905fe5292e807e5c4cad25a /Modules/_abc.c | |
parent | fdd878650d325297cd801305bc2d1b0e903e42b4 (diff) | |
download | cpython-f73abf8e03fd370c86fbb2a249fe1e065f7d84b4.zip cpython-f73abf8e03fd370c86fbb2a249fe1e065f7d84b4.tar.gz cpython-f73abf8e03fd370c86fbb2a249fe1e065f7d84b4.tar.bz2 |
gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)
This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
Diffstat (limited to 'Modules/_abc.c')
-rw-r--r-- | Modules/_abc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c index 9d6654b..997b618 100644 --- a/Modules/_abc.c +++ b/Modules/_abc.c @@ -452,7 +452,8 @@ _abc__abc_init(PyObject *module, PyObject *self) * their special status w.r.t. pattern matching. */ if (PyType_Check(self)) { PyTypeObject *cls = (PyTypeObject *)self; - PyObject *flags = PyDict_GetItemWithError(cls->tp_dict, + PyObject *dict = _PyType_GetDict(cls); + PyObject *flags = PyDict_GetItemWithError(dict, &_Py_ID(__abc_tpflags__)); if (flags == NULL) { if (PyErr_Occurred()) { @@ -471,7 +472,7 @@ _abc__abc_init(PyObject *module, PyObject *self) } ((PyTypeObject *)self)->tp_flags |= (val & COLLECTION_FLAGS); } - if (PyDict_DelItem(cls->tp_dict, &_Py_ID(__abc_tpflags__)) < 0) { + if (PyDict_DelItem(dict, &_Py_ID(__abc_tpflags__)) < 0) { return NULL; } } @@ -742,7 +743,7 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self, Py_DECREF(ok); /* 4. Check if it's a direct subclass. */ - PyObject *mro = ((PyTypeObject *)subclass)->tp_mro; + PyObject *mro = _PyType_GetMRO((PyTypeObject *)subclass); assert(PyTuple_Check(mro)); for (pos = 0; pos < PyTuple_GET_SIZE(mro); pos++) { PyObject *mro_item = PyTuple_GET_ITEM(mro, pos); |