Skip to content

Commit 06618d8

Browse files
committed
use AC for type checking
1 parent 2d3bd7c commit 06618d8

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

Python/clinic/sysmodule.c.h

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/sysmodule.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,7 @@ sys__baserepl_impl(PyObject *module)
26442644
/*[clinic input]
26452645
sys._clear_type_descriptors
26462646
2647-
type: object
2647+
type: object(subclass_of='&PyType_Type')
26482648
/
26492649
26502650
Private function for clearing certain descriptors from a type's dictionary.
@@ -2653,14 +2653,10 @@ See gh-135228 for context.
26532653
[clinic start generated code]*/
26542654

26552655
static PyObject *
2656-
sys__clear_type_descriptors(PyObject *module, PyObject *type)
2657-
/*[clinic end generated code: output=7d5cefcf861909e0 input=5fdc23500d477de6]*/
2656+
sys__clear_type_descriptors_impl(PyObject *module, PyObject *type)
2657+
/*[clinic end generated code: output=5ad17851b762b6d9 input=dc536c97fde07251]*/
26582658
{
2659-
if (!PyType_Check(type)) {
2660-
PyErr_SetString(PyExc_TypeError, "argument must be a type");
2661-
return NULL;
2662-
}
2663-
PyTypeObject *typeobj = (PyTypeObject *)(type);
2659+
PyTypeObject *typeobj = (PyTypeObject *)type;
26642660
if (_PyType_HasFeature(typeobj, Py_TPFLAGS_IMMUTABLETYPE)) {
26652661
PyErr_SetString(PyExc_TypeError, "argument is immutable");
26662662
return NULL;

0 commit comments

Comments
 (0)