Skip to content

Commit 35b0fd7

Browse files
committed
Merge 3.5
2 parents f9a7115 + d5871e6 commit 35b0fd7

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

Modules/_tracemalloc.c

+1-15
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ get_reentrant(void)
216216
static void
217217
set_reentrant(int reentrant)
218218
{
219-
assert(!reentrant || !get_reentrant());
219+
assert(reentrant != tracemalloc_reentrant);
220220
tracemalloc_reentrant = reentrant;
221221
}
222222
#endif
@@ -879,10 +879,6 @@ tracemalloc_clear_traces(void)
879879
assert(PyGILState_Check());
880880
#endif
881881

882-
/* Disable also reentrant calls to tracemalloc_malloc() to not add a new
883-
trace while we are clearing traces */
884-
assert(get_reentrant());
885-
886882
TABLES_LOCK();
887883
_Py_hashtable_clear(tracemalloc_traces);
888884
tracemalloc_traced_memory = 0;
@@ -971,11 +967,6 @@ tracemalloc_init(void)
971967
tracemalloc_empty_traceback.frames[0].lineno = 0;
972968
tracemalloc_empty_traceback.hash = traceback_hash(&tracemalloc_empty_traceback);
973969

974-
/* Disable tracing allocations until hooks are installed. Set
975-
also the reentrant flag to detect bugs: fail with an assertion error
976-
if set_reentrant(1) is called while tracing is disabled. */
977-
set_reentrant(1);
978-
979970
tracemalloc_config.initialized = TRACEMALLOC_INITIALIZED;
980971
return 0;
981972
}
@@ -1063,7 +1054,6 @@ tracemalloc_start(int max_nframe)
10631054

10641055
/* everything is ready: start tracing Python memory allocations */
10651056
tracemalloc_config.tracing = 1;
1066-
set_reentrant(0);
10671057

10681058
return 0;
10691059
}
@@ -1078,10 +1068,6 @@ tracemalloc_stop(void)
10781068
/* stop tracing Python memory allocations */
10791069
tracemalloc_config.tracing = 0;
10801070

1081-
/* set the reentrant flag to detect bugs: fail with an assertion error if
1082-
set_reentrant(1) is called while tracing is disabled. */
1083-
set_reentrant(1);
1084-
10851071
/* unregister the hook on memory allocators */
10861072
#ifdef TRACE_RAW_MALLOC
10871073
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &allocators.raw);

0 commit comments

Comments
 (0)