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 pitrou
Recipients gvanrossum, jcea, meador.inge, pitrou, python-dev, sbt
Date 2011-12-21.10:35:16
SpamBayes Score 8.44627e-10
Marked as misclassified No
Message-id <1324463717.89.0.103358976757.issue13577@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the patch. Since you modified PyCFunction_GET_SELF to return NULL for static methods, why not simply use it instead of manually looking up the flags in several places?

I'm talking about the following changes:

-    PyObject *self = PyCFunction_GET_SELF(func);
+    int flags = PyCFunction_GET_FLAGS(func);
+    PyObject *self = flags & METH_STATIC ? NULL :
+        _PyCFunction_GET_RAW_SELF(func);

[...]

     self = m->m_self;
-    if (self == NULL)
+    if (self == NULL || PyCFunction_GET_FLAGS(m) & METH_STATIC)
         self = Py_None;

[...]

-            PyObject *self = PyCFunction_GET_SELF(func);
+            PyObject *self = flags & METH_STATIC ? NULL :
+                _PyCFunction_GET_RAW_SELF(func);


Unless you demonstrate there's a significant performance improvement in this style, we should really favour the simpler style.
History
Date User Action Args
2011-12-21 10:35:18pitrousetrecipients: + pitrou, gvanrossum, jcea, meador.inge, python-dev, sbt
2011-12-21 10:35:17pitrousetmessageid: <1324463717.89.0.103358976757.issue13577@psf.upfronthosting.co.za>
2011-12-21 10:35:17pitroulinkissue13577 messages
2011-12-21 10:35:16pitroucreate