Skip to content

Commit a9483b4

Browse files
JelleZijlstraencukouserhiy-storchaka
authored
Apply suggestions from code review
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 250f3e9 commit a9483b4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Python/sysmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,17 +2661,17 @@ sys__clear_type_descriptors(PyObject *module, PyObject *type)
26612661
return NULL;
26622662
}
26632663
PyTypeObject *typeobj = (PyTypeObject *)(type);
2664-
if (!_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE)) {
2665-
PyErr_SetString(PyExc_TypeError, "argument must be a heap type");
2664+
if (!_PyType_HasFeature(typeobj, Py_TPFLAGS_IMMUTABLETYPE)) {
2665+
PyErr_SetString(PyExc_TypeError, "argument is immutable");
26662666
return NULL;
26672667
}
26682668
PyObject *dict = _PyType_GetDict(typeobj);
26692669
PyObject *dunder_dict = NULL;
2670-
if (PyDict_PopString(dict, "__dict__", &dunder_dict) < 0) {
2670+
if (PyDict_Pop(dict, &_Py_ID(__dict__), &dunder_dict) < 0) {
26712671
return NULL;
26722672
}
26732673
PyObject *dunder_weakref = NULL;
2674-
if (PyDict_PopString(dict, "__weakref__", &dunder_weakref) < 0) {
2674+
if (PyDict_Pop(dict, &_Py_ID(__weakref__), &dunder_weakref) < 0) {
26752675
PyType_Modified(typeobj);
26762676
Py_XDECREF(dunder_dict);
26772677
return NULL;

0 commit comments

Comments
 (0)