[Python-Dev] Status of the Argument Clinic DSL (original) (raw)
eryk sun eryksun at gmail.com
Thu Aug 4 20:27:02 EDT 2016
- Previous message (by thread): [Python-Dev] Status of the Argument Clinic DSL
- Next message (by thread): [Python-Dev] Status of the Argument Clinic DSL
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Aug 4, 2016 at 11:33 PM, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:
On Thu, Aug 4, 2016 at 7:12 PM, Larry Hastings <larry at hastings.org> wrote:
C extension functions get the module passed in automatically, but this is done internally and from the Python level you can't see it. Always something new to learn! This was not so in Python 2.x - self was passed as NULL to the C module functions. When did this change?
In 2.x this is the self
parameter (actually named "passthrough" in
the source) of Py_InitModule4 [1, 2]. You probably use the
Py_InitModule or Py_InitModule3 macros, which pass NULL for this
parameter:
#define Py_InitModule(name, methods) \
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
PYTHON_API_VERSION)
#define Py_InitModule3(name, methods, doc) \
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)
Python 3's PyModule_Create2 [3-5] API makes this a reference to the module. It's currently implemented in PyModule_AddFunctions [6, 7].
- Previous message (by thread): [Python-Dev] Status of the Argument Clinic DSL
- Next message (by thread): [Python-Dev] Status of the Argument Clinic DSL
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]