mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)
This commit is contained in:
parent
882fcede83
commit
72d3cc94cd
15 changed files with 116 additions and 119 deletions
|
@ -140,13 +140,10 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (PyDict_GetItemRef(mkw, &_Py_ID(metaclass), &meta) < 0) {
|
||||
if (PyDict_Pop(mkw, &_Py_ID(metaclass), &meta) < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (meta != NULL) {
|
||||
if (PyDict_DelItem(mkw, &_Py_ID(metaclass)) < 0) {
|
||||
goto error;
|
||||
}
|
||||
/* metaclass is explicitly given, check if it's indeed a class */
|
||||
isclass = PyType_Check(meta);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue