Meador Inge <[email protected]> added the comment:
For the most part this looks OK, but I am not sure about this hunk:
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3724,7 +3724,7 @@ add_methods(PyTypeObject *type, PyMethod
descr = PyDescr_NewClassMethod(type, meth);
}
else if (meth->ml_flags & METH_STATIC) {
- PyObject *cfunc = PyCFunction_New(meth, NULL);
+ PyObject *cfunc = PyCFunction_New(meth, (PyObject*)type);
if (cfunc == NULL)
return -1;
descr = PyStaticMethod_New(cfunc);
That may be a breaking change as existing code may rely on the 'None' behavior.
In
fact, this causes a unit test to fail with the patch applied:
[meadori@motherbrain cpython]$ ./python -m test test_descr
[1/1] test_descr
test test_descr failed -- Traceback (most recent call last):
File "/home/meadori/src/python/cpython/Lib/test/test_descr.py", line 1485, in
test_staticmethods_in_c
self.assertEqual(x, None)
AssertionError: <class 'xxsubtype.spamlist'> != None
sbt, have you been running the test suite before submitting patches? If not,
then
please do.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com