[issue3329] API for setting the memory allocator used by Python

STINNER Victor report at bugs.python.org
Thu Jun 13 12:44:33 CEST 2013


STINNER Victor added the comment:

> This patch does not propose a simple API to reuse internal
> debug hooks when replacing system (PyMem) allocators.

Ok, this is now fixed with new patch (version 5). Nick does not want a new environment variable, so I added instead a new function PyMem_SetupDebugHooks() which reinstalls hooks to detect bugs if allocator functions were replaced with PyMem_SetAllocators() or PyObject_SetAllocators(). The function does nothing is Python is not compiled in debug more or if hooks are already installed (so the function can be called twice).

I also added unit tests for PyMem_SetAllocators() and PyObject_SetAllocators()! And I added "versionadded:: 3.4" to the C API documentation.

----------
Added file: http://bugs.python.org/file30575/py_setallocators-5.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3329>
_______________________________________


More information about the Python-bugs-list mailing list