summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threaded_import.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-18 21:18:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-18 21:18:17 (GMT)
commit202b60640bd873f00ee121cb24ee4a6409eb8993 (patch)
treeb68efa0e9ea52da603ab0baa80481502d356f689 /Lib/test/test_threaded_import.py
parent5b89840d9cf11014a4b865d79497649f74bf2866 (diff)
downloadcpython-202b60640bd873f00ee121cb24ee4a6409eb8993.zip
cpython-202b60640bd873f00ee121cb24ee4a6409eb8993.tar.gz
cpython-202b60640bd873f00ee121cb24ee4a6409eb8993.tar.bz2
Add sanity assertions in some import lock code (issue #15599).
Diffstat (limited to 'Lib/test/test_threaded_import.py')
-rw-r--r--Lib/test/test_threaded_import.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 0528b13..93bfb2a 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -68,6 +68,7 @@ class Finder:
# Simulate some thread-unsafe behaviour. If calls to find_module()
# are properly serialized, `x` will end up the same as `numcalls`.
# Otherwise not.
+ assert imp.lock_held()
with self.lock:
self.numcalls += 1
x = self.x