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
4a066475
Commit
4a066475
authored
Mar 22, 2016
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assertions on tracemalloc_reentrant_key
Issue #26588.
parent
0cfc058d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
Modules/_tracemalloc.c
Modules/_tracemalloc.c
+8
-2
No files found.
Modules/_tracemalloc.c
View file @
4a066475
...
...
@@ -167,7 +167,7 @@ tracemalloc_error(const char *format, ...)
# error "need native thread local storage (TLS)"
#endif
static
int
tracemalloc_reentrant_key
;
static
int
tracemalloc_reentrant_key
=
-
1
;
/* Any non-NULL pointer can be used */
#define REENTRANT Py_True
...
...
@@ -175,7 +175,10 @@ static int tracemalloc_reentrant_key;
static
int
get_reentrant
(
void
)
{
void
*
ptr
=
PyThread_get_key_value
(
tracemalloc_reentrant_key
);
void
*
ptr
;
assert
(
tracemalloc_reentrant_key
!=
-
1
);
ptr
=
PyThread_get_key_value
(
tracemalloc_reentrant_key
);
if
(
ptr
!=
NULL
)
{
assert
(
ptr
==
REENTRANT
);
return
1
;
...
...
@@ -188,6 +191,8 @@ static void
set_reentrant
(
int
reentrant
)
{
assert
(
reentrant
==
0
||
reentrant
==
1
);
assert
(
tracemalloc_reentrant_key
!=
-
1
);
if
(
reentrant
)
{
assert
(
!
get_reentrant
());
PyThread_set_key_value
(
tracemalloc_reentrant_key
,
REENTRANT
);
...
...
@@ -1018,6 +1023,7 @@ DEBUG("tracemalloc_deinit(): exit (not initialized)");
DEBUG
(
"tracemalloc_deinit(): delete reentrant key"
);
#ifdef REENTRANT_THREADLOCAL
PyThread_delete_key
(
tracemalloc_reentrant_key
);
tracemalloc_reentrant_key
=
-
1
;
#endif
Py_XDECREF
(
unknown_filename
);
...
...
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