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

Skip to content

Commit ae9f161

Browse files
committed
Issue #19512: __build_class() builtin now uses an identifier for the "metaclass" string
1 parent 0905437 commit ae9f161

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Python/bltinmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
4444
Py_ssize_t nargs;
4545
int isclass;
4646
_Py_IDENTIFIER(__prepare__);
47+
_Py_IDENTIFIER(metaclass);
4748

4849
assert(args != NULL);
4950
if (!PyTuple_Check(args)) {
@@ -83,10 +84,10 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
8384
Py_DECREF(bases);
8485
return NULL;
8586
}
86-
meta = PyDict_GetItemString(mkw, "metaclass");
87+
meta = _PyDict_GetItemId(mkw, &PyId_metaclass);
8788
if (meta != NULL) {
8889
Py_INCREF(meta);
89-
if (PyDict_DelItemString(mkw, "metaclass") < 0) {
90+
if (_PyDict_DelItemId(mkw, &PyId_metaclass) < 0) {
9091
Py_DECREF(meta);
9192
Py_DECREF(mkw);
9293
Py_DECREF(bases);

0 commit comments

Comments
 (0)