Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
In the main branch, the function_tracemalloc__get_object_traceback doesn't account for objects with preheaders:
cpython/Modules/_tracemalloc.c
Lines 1406 to 1414 inea23271
| type=Py_TYPE(obj); | |
| if (PyType_IS_GC(type)) { | |
| ptr= (void*)((char*)obj-sizeof(PyGC_Head)); | |
| } | |
| else { | |
| ptr= (void*)obj; | |
| } | |
| traceback=tracemalloc_get_traceback(DEFAULT_DOMAIN, (uintptr_t)ptr); |
This means that when running with tracemalloc some allocation tracebacks are missing:
importwarningsclassMyClass:def__del__(self):warnings.warn("Uh oh",ResourceWarning,source=self)deffunc():m=MyClass()func()
python3 -Wd -X tracemalloc=2 example.py