mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
gh-101430: Update tracemalloc to handle presize properly. (gh-101745)
This commit is contained in:
parent
f1f3af7b82
commit
5b946d3719
3 changed files with 12 additions and 23 deletions
|
|
@ -2387,14 +2387,9 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
|
|||
/* Display the traceback where the object has been allocated.
|
||||
Do it before dumping repr(obj), since repr() is more likely
|
||||
to crash than dumping the traceback. */
|
||||
void *ptr;
|
||||
PyTypeObject *type = Py_TYPE(obj);
|
||||
if (_PyType_IS_GC(type)) {
|
||||
ptr = (void *)((char *)obj - sizeof(PyGC_Head));
|
||||
}
|
||||
else {
|
||||
ptr = (void *)obj;
|
||||
}
|
||||
const size_t presize = _PyType_PreHeaderSize(type);
|
||||
void *ptr = (void *)((char *)obj - presize);
|
||||
_PyMem_DumpTraceback(fileno(stderr), ptr);
|
||||
|
||||
/* This might succeed or fail, but we're about to abort, so at least
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue