[Python-Dev] PEP 442 undocumented C API functions (original) (raw)

Pauli Virtanen pav at iki.fi
Sat Aug 26 02:31:00 EDT 2017


Hi,

PEP 442 says "Two new C API functions are provided to ease calling of tp_finalize, especially from custom deallocators."

This includes PyObject_CallFinalizerFromDealloc. However, no documentation of these functions appears to exist (https://bugs.python. org/issue31276).

As far as I understand, if you have a custom tp_dealloc, you have to call PyObject_CallFinalizerFromDealloc in order to get your tp_finalize called. Is this correct?

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 tp_finalize supposed to be used?

I'd be happy if someone can clarify the issue.

-- Pauli Virtanen



More information about the Python-Dev mailing list