-
Notifications
You must be signed in to change notification settings - Fork 3
Preliminary PEP 573 (module state access) implementation #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
71ea794
e438e41
44886c5
c0fe53b
d010680
95a0a61
6ee77d8
36a0a9f
6c39835
f7033c4
6fc8a5e
3f1623f
2e124a8
adc1daa
7787175
04a0dc8
1df0e6d
b4be6d8
03ed6dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #ifndef Py_CPYTHON_METHODOBJECT_H | ||
encukou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # error "this header file must not be included directly" | ||
| #endif | ||
|
|
||
| /* Macros for direct access to these values. Type checks are *not* | ||
| done, so use with care. */ | ||
| #define PyCFunction_GET_FUNCTION(func) \ | ||
| (((PyCFunctionObject *)func) -> m_ml -> ml_meth) | ||
| #define PyCFunction_GET_SELF(func) \ | ||
| (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ | ||
| NULL : ((PyCFunctionObject *)func) -> m_self) | ||
| #define PyCFunction_GET_FLAGS(func) \ | ||
| (((PyCFunctionObject *)func) -> m_ml -> ml_flags) | ||
| #define PyCFunction_GET_CLASS(func) \ | ||
| (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_METHOD ? \ | ||
| ((PyCMethodObject *)func) -> mm_class : NULL) | ||
|
|
||
| typedef struct { | ||
| PyObject_VAR_HEAD | ||
|
||
| PyMethodDef *m_ml; /* Description of the C function to call */ | ||
| PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ | ||
| PyObject *m_module; /* The __module__ attribute, can be anything */ | ||
| PyObject *m_weakreflist; /* List of weak references */ | ||
| vectorcallfunc vectorcall; | ||
| } PyCFunctionObject; | ||
|
|
||
| typedef struct { | ||
| PyCFunctionObject func; | ||
| PyTypeObject *mm_class; /* Class that defines this method */ | ||
| } PyCMethodObject; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Module C state is now accessible from C-defined heap type methods. (PEP-573) | ||
| Patch by Marcel Plch and Petr Viktorin. |
Uh oh!
There was an error while loading. Please reload this page.