This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ammar2, cstratak, hroncok, methane, pablogsal, serhiy.storchaka, vstinner
Date 2019-12-06.17:31:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> In case of malloc, every memory allocating code need to use malloc/calloc/realloc. This is official and the only way to allocate a memory. But we do not guarantee that Python core uses only public C API like PyErr_Occurred(). It can use more low-level and efficient but less safer C API internally. It can replace the function with a macro which access internal structures directly (for compiling the core only). And this is actually the case. Overridding the public C API functions not always has an effect on the core.

To confirm what you said: if we take the specific example of PyErr_Occurred(), I recently added a new _PyErr_Occurred() function which is declared as a static inline function. _PyErr_Occurred() cannot be overriden.

static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
    assert(tstate != NULL);
    return tstate->curexc_type;
Date User Action Args
2019-12-06 17:31:06vstinnersetrecipients: + vstinner, methane, serhiy.storchaka, cstratak, ammar2, hroncok, pablogsal
2019-12-06 17:31:06vstinnersetmessageid: <>
2019-12-06 17:31:06vstinnerlinkissue38980 messages
2019-12-06 17:31:06vstinnercreate