summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-02-09 23:30:03 (GMT)
committerGitHub <noreply@github.com>2023-02-09 23:30:03 (GMT)
commit5b946d371979a772120e6ee7d37f9b735769d433 (patch)
tree2c48db4788406bf49a07416055513e37cb5661a2 /Objects/object.c
parentf1f3af7b8245e61a2e0abef03b2c6c5902ed7df8 (diff)
downloadcpython-5b946d371979a772120e6ee7d37f9b735769d433.zip
cpython-5b946d371979a772120e6ee7d37f9b735769d433.tar.gz
cpython-5b946d371979a772120e6ee7d37f9b735769d433.tar.bz2
gh-101430: Update tracemalloc to handle presize properly. (gh-101745)
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 7817c04..446c7b1 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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