Message149981
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. |
|
Date |
User |
Action |
Args |
2011-12-21 10:35:18 | pitrou | set | recipients:
+ pitrou, gvanrossum, jcea, meador.inge, python-dev, sbt |
2011-12-21 10:35:17 | pitrou | set | messageid: <1324463717.89.0.103358976757.issue13577@psf.upfronthosting.co.za> |
2011-12-21 10:35:17 | pitrou | link | issue13577 messages |
2011-12-21 10:35:16 | pitrou | create | |
|