| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| PyObject *capsule = PyCapsule_New(capi, PyDateTime_CAPSULE_NAME, | ||
| datetime_destructor); | ||
| set_datetime_capi(st); | ||
| PyObject *capsule = PyCapsule_New(&st->capi, PyDateTime_CAPSULE_NAME, NULL); |
There was a problem hiding this comment.
Can you explain why do you pass a NULL as a capsule destructor?
Is there any reason not to have destructor for this capsule?
Sorry, something went wrong.
There was a problem hiding this comment.
In this case, the capsule just views a memory allocated and freed by the moduleobject.
cpython/Objects/moduleobject.c
Lines 739 to 740 in bfc57d4
Sorry, something went wrong.
|
No futher experiment here. |
Sorry, something went wrong.
|
On second thought, exposing a module state to a user is dangerous. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This places C-API structure on a module state, which can be accessed through PyInterpreterState or a capsule.
Doc: