Skip to content

Commit

Permalink
PyObject_GetAttr -> PyObject_GetOptionalAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Feb 10, 2024
1 parent 9b31877 commit 8d2f05d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6653,7 +6653,8 @@ 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;
PyObject_GetOptionalAttr((PyObject*)type, &_Py_ID(__module__), &mod);
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, mod);
Py_XDECREF(mod);
if (cfunc == NULL) {
Expand Down

0 comments on commit 8d2f05d

Please sign in to comment.