[Python-Dev] PEP 442 undocumented C API functions (original) (raw)
INADA Naoki songofacandy at gmail.com
Mon Aug 28 02:49:17 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 442 undocumented C API functions
- Next message (by thread): [Python-Dev] how to dump cst
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, thanks to your report.
As far as I understand, if you have a custom tpdealloc, you have to call PyObjectCallFinalizerFromDealloc in order to get your tpfinalize called. Is this correct?
Sorry, I'm not expert of Object finalization process.
But If my understanding is correct, you're almost right.
When a type has custom tp_finalize, it have to call
PyObject_CallFinalizerFromDealloc
.
And to allow subclass, it should be like this: https://github.com/python/cpython/blob/ed94a8b2851914bcda3a77b28b25517b8baa91e6/Modules/_asynciomodule.c#L1836-L1849
However, since the necessary functions are undocumented, it's unclear if they were intended to be public Python API functions. So are they actually public functions that 3rd party extensions can call? If not, how is tpfinalize supposed to be used?
While I don't want tp_finalize is used widely (like __del__
), I
agree with you.
But I'm not good English writer.
Contribution is welcome.
Regards,
INADA Naoki <songofacandy at gmail.com>
- Previous message (by thread): [Python-Dev] PEP 442 undocumented C API functions
- Next message (by thread): [Python-Dev] how to dump cst
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]