Message149981
| Author |
pitrou |
| Recipients |
gvanrossum, jcea, meador.inge, pitrou, python-dev, sbt |
| Date |
2011年12月21日.10:35:16 |
| SpamBayes Score |
8.446273e-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: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 |
|