Message149379
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. |
|
Date |
User |
Action |
Args |
2011-12-13 05:57:56 | meador.inge | set | recipients:
+ meador.inge, gvanrossum, jcea, pitrou, python-dev, sbt |
2011-12-13 05:57:56 | meador.inge | set | messageid: <1323755876.56.0.465644984145.issue13577@psf.upfronthosting.co.za> |
2011-12-13 05:57:55 | meador.inge | link | issue13577 messages |
2011-12-13 05:57:55 | meador.inge | create | |
|