I need to import one of the main modules ( datetime ) inside my C extension module, since I want to return datetime.date from some functions of my module.
It seems that the Python C extension modules do not have an add-on for PyMODINIT_FUNC upon destruction.
Question:. What can I do without waiting for the time and time of the required module to appear again in every call inside my C extension module, and then dereference it at the end of the call (s) again?
Rationale: Basically, I am afraid that this (importing it again and again) will create unnecessary overhead, because due to my understanding of dereferencing the documentation, this means that the garbage collector can come and collect it, so next time PyImport_ImportModule will need to be called again .
A few related questions:
source share