numpy/numpy — pull request #284 by thouis (2012-05-21 17:21:12+00:00)
Title: Add data memory allocation tracing facilities.

Add numpy.core.multiarray.trace_data_allocations() function for
controlling tracing malloc/free/realloc for numpy data. This
functionality is exposed by #defing NPY_TRACE_DATA_MALLOC to 1 in
ndarraytypes.h (the default with this commit). When enabled,
PyDataMem_NEW/FREE/RENEW become actual functions, defined in
multiarraymodule.c, which call back into Python if callbacks are
registered with trace_data_allocations().

Also added tests, including handling python errors during a
callback,which I think should probably log errors but not actually
raise an exception.