This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients gvanrossum, jcea, meador.inge, pitrou, python-dev, sbt
Date 2011-12-13.05:57:55
SpamBayes Score 1.6021422e-05
Marked as misclassified No
Message-id <1323755876.56.0.465644984145.issue13577@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-12-13 05:57:56meador.ingesetrecipients: + meador.inge, gvanrossum, jcea, pitrou, python-dev, sbt
2011-12-13 05:57:56meador.ingesetmessageid: <1323755876.56.0.465644984145.issue13577@psf.upfronthosting.co.za>
2011-12-13 05:57:55meador.ingelinkissue13577 messages
2011-12-13 05:57:55meador.ingecreate