mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a memory block was allocated on memory block. Use the tracemalloc module to get the traceback.
This commit is contained in:
parent
af584a02a5
commit
0611c26a58
8 changed files with 126 additions and 19 deletions
|
@ -2820,6 +2820,7 @@ bytearray_hex(PyBytesObject *self)
|
|||
{
|
||||
char* argbuf = PyByteArray_AS_STRING(self);
|
||||
Py_ssize_t arglen = PyByteArray_GET_SIZE(self);
|
||||
PyByteArray_AS_STRING(self)[arglen+1] = 2;
|
||||
return _Py_strhex(argbuf, arglen);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#include "Python.h"
|
||||
|
||||
|
||||
/* Defined in tracemalloc.c */
|
||||
extern void _PyMem_DumpTraceback(int fd, const void *ptr);
|
||||
|
||||
|
||||
/* Python's malloc wrappers (see pymem.h) */
|
||||
|
||||
/*
|
||||
|
@ -2202,6 +2207,10 @@ _PyObject_DebugDumpAddress(const void *p)
|
|||
}
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
fputc('\n', stderr);
|
||||
|
||||
fflush(stderr);
|
||||
_PyMem_DumpTraceback(fileno(stderr), p);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue