Mercurial > cpython-lru_cache-weakref
diff Include/methodobject.h @ 27559:faabd9867fb8 legacy-trunk
Provide __module__ attributes for functions defined in C and Python.
__module__ is the string name of the module the function was defined
in, just like __module__ of classes. In some cases, particularly for
C functions, the __module__ may be None.
Change PyCFunction_New() from a function to a macro, but keep an
unused copy of the function around so that we don't change the binary
API.
Change pickle's save_global() to use whichmodule() if __module__ is
None, but add the __module__ logic to whichmodule() since it might be
used outside of pickle.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Fri, 31 Jan 2003 18:33:18 +0000 |
| parents | c1eb668525e1 |
| children | e4fb6164158c |
line wrap: on
line diff
--- a/Include/methodobject.h Fri Jan 31 18:15:58 2003 +0000 +++ b/Include/methodobject.h Fri Jan 31 18:33:18 2003 +0000 @@ -40,7 +40,9 @@ PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); -PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); +#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) +PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, + PyObject *); /* Flag passed to newmethodobject */ #define METH_OLDARGS 0x0000 @@ -68,6 +70,7 @@ PyObject_HEAD PyMethodDef *m_ml; PyObject *m_self; + PyObject *m_module; } PyCFunctionObject; #ifdef __cplusplus
