Add sanity assertions in some import lock code (issue #15599).

This commit is contained in:
Antoine Pitrou 2012-12-18 22:18:17 +01:00
parent 5b89840d9c
commit 202b60640b
2 changed files with 3 additions and 0 deletions

View file

@ -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