-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-115231: fill __module__ for built-in staticmethods #115232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
9b31877
be1c7ef
1f854ee
c4dec10
1e25d84
63b05a0
777bc8d
d1650bf
d0f5bb0
e20339b
4ba1288
543a5b3
b3fbb8c
6666a1a
386f383
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Setup ``__module__`` attribute for built-in static methods. Patch by Sergey | ||
B Kirpichev. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6653,7 +6653,9 @@ type_add_method(PyTypeObject *type, PyMethodDef *meth) | |
descr = PyDescr_NewClassMethod(type, meth); | ||
} | ||
else if (meth->ml_flags & METH_STATIC) { | ||
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL); | ||
PyObject *mod = PyObject_GetAttr((PyObject*)type, &_Py_ID(__module__)); | ||
|
||
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, mod); | ||
Py_XDECREF(mod); | ||
if (cfunc == NULL) { | ||
return -1; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.