Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8eda2b25
Commit
8eda2b25
authored
Mar 22, 2016
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26588: more assertions
parent
7849fb2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
Modules/_tracemalloc.c
Modules/_tracemalloc.c
+23
-2
No files found.
Modules/_tracemalloc.c
View file @
8eda2b25
...
...
@@ -189,11 +189,11 @@ set_reentrant(int reentrant)
{
assert
(
reentrant
==
0
||
reentrant
==
1
);
if
(
reentrant
)
{
assert
(
PyThread_get_key_value
(
tracemalloc_reentrant_key
)
==
NULL
);
assert
(
!
get_reentrant
()
);
PyThread_set_key_value
(
tracemalloc_reentrant_key
,
REENTRANT
);
}
else
{
assert
(
PyThread_get_key_value
(
tracemalloc_reentrant_key
)
==
REENTRANT
);
assert
(
get_reentrant
()
);
PyThread_set_key_value
(
tracemalloc_reentrant_key
,
NULL
);
}
}
...
...
@@ -901,6 +901,11 @@ static int
tracemalloc_init
(
void
)
{
DEBUG
(
"tracemalloc_init()"
);
#ifdef WITH_THREAD
assert
(
PyGILState_Check
());
#endif
if
(
tracemalloc_config
.
initialized
==
TRACEMALLOC_FINALIZED
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"the tracemalloc module has been unloaded"
);
...
...
@@ -1027,6 +1032,11 @@ tracemalloc_start(int max_nframe)
size_t
size
;
DEBUG
(
"tracemalloc_start()"
);
#ifdef WITH_THREAD
assert
(
PyGILState_Check
());
#endif
if
(
tracemalloc_init
()
<
0
)
{
DEBUG
(
"tracemalloc_start(): ERROR! init failed!"
);
return
-
1
;
...
...
@@ -1035,8 +1045,10 @@ DEBUG("tracemalloc_start(): ERROR! init failed!");
if
(
tracemalloc_config
.
tracing
)
{
/* hook already installed: do nothing */
DEBUG
(
"tracemalloc_start(): exit (already tracing)"
);
assert
(
!
get_reentrant
());
return
0
;
}
assert
(
get_reentrant
());
assert
(
1
<=
max_nframe
&&
max_nframe
<=
MAX_NFRAME
);
tracemalloc_config
.
max_nframe
=
max_nframe
;
...
...
@@ -1081,6 +1093,7 @@ DEBUG("tracemalloc_start(): set_reentrant(0)");
set_reentrant
(
0
);
DEBUG
(
"tracemalloc_start(): done"
);
assert
(
!
get_reentrant
());
return
0
;
}
...
...
@@ -1089,10 +1102,17 @@ static void
tracemalloc_stop
(
void
)
{
DEBUG
(
"tracemalloc_stop()"
);
#ifdef WITH_THREAD
assert
(
PyGILState_Check
());
#endif
if
(
!
tracemalloc_config
.
tracing
)
{
DEBUG
(
"tracemalloc_stop(): exit (not tracing)"
);
assert
(
get_reentrant
());
return
;
}
assert
(
!
get_reentrant
());
/* stop tracing Python memory allocations */
tracemalloc_config
.
tracing
=
0
;
...
...
@@ -1115,6 +1135,7 @@ DEBUG("tracemalloc_stop(): set_reentrant(1)");
raw_free
(
tracemalloc_traceback
);
tracemalloc_traceback
=
NULL
;
DEBUG
(
"tracemalloc_stop(): done"
);
assert
(
get_reentrant
());
}
PyDoc_STRVAR
(
tracemalloc_is_tracing_doc
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment