Skip to content

Commit d7ffacf

Browse files
committed
Fix tracemalloc_free()
Don't remove the trace if it's a reentrant call.
1 parent 867f20b commit d7ffacf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/tracemalloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,10 @@ tracemalloc_free(void *ctx, void *ptr)
617617
PyMemAllocatorEx *alloc = (PyMemAllocatorEx *)ctx;
618618
alloc->free(alloc->ctx, ptr);
619619

620+
if (get_reentrant()) {
621+
return;
622+
}
623+
620624
TABLES_LOCK();
621625
REMOVE_TRACE(ptr);
622626
TABLES_UNLOCK();

0 commit comments

Comments
 (0)