summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/automap.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-01-03 21:49:49 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-01-03 21:49:49 +0000
commitc0352b03e840ddf68116182b22c5fd4eac2059cf (patch)
tree46c46a3d151197f149348680fcbbc18bdc395e81 /lib/sqlalchemy/ext/automap.py
parent5881fd274015af3de37f2ff0f91ff6a7c61c1540 (diff)
parenta076b1f30406cbb59a55e2c01ddd17a84636778e (diff)
downloadsqlalchemy-c0352b03e840ddf68116182b22c5fd4eac2059cf.tar.gz
Merge "Use context managers for threading.Lock()"
Diffstat (limited to 'lib/sqlalchemy/ext/automap.py')
-rw-r--r--lib/sqlalchemy/ext/automap.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/sqlalchemy/ext/automap.py b/lib/sqlalchemy/ext/automap.py
index 6d458ab56..e409cf38c 100644
--- a/lib/sqlalchemy/ext/automap.py
+++ b/lib/sqlalchemy/ext/automap.py
@@ -762,8 +762,7 @@ class AutomapBase(object):
autoload_replace=False,
)
- _CONFIGURE_MUTEX.acquire()
- try:
+ with _CONFIGURE_MUTEX:
table_to_map_config = dict(
(m.local_table, m)
for m in _DeferredMapperConfig.classes_for_base(
@@ -818,8 +817,6 @@ class AutomapBase(object):
for map_config in _DeferredMapperConfig.classes_for_base(cls):
map_config.map()
- finally:
- _CONFIGURE_MUTEX.release()
_sa_decl_prepare = True
"""Indicate that the mapping of classes should be deferred.