From 777bc8d363e81a7c712ee3426a1b80ee5ab26aa7 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 2 Nov 2024 14:20:55 +0300 Subject: [PATCH] address review: use type_module() --- Objects/typeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e87763a54d4ae8..813b77a9002bcf 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -7611,7 +7611,7 @@ type_add_method(PyTypeObject *type, PyMethodDef *meth) descr = PyDescr_NewClassMethod(type, meth); } else if (meth->ml_flags & METH_STATIC) { - PyObject *mod = PyObject_GetAttr((PyObject*)type, &_Py_ID(__module__)); + PyObject *mod = type_module(type); PyErr_Clear(); PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, mod); Py_XDECREF(mod);