diff options
| author | Gord Thompson <gord@gordthompson.com> | 2020-03-01 11:30:56 -0700 |
|---|---|---|
| committer | Gord Thompson <gord@gordthompson.com> | 2020-03-02 10:37:20 -0700 |
| commit | 49d78c335403802b8035d0d6f61c92b3f7969174 (patch) | |
| tree | 539922fc5d3b1118aca223d21c15ae52e4cc34c2 /lib/sqlalchemy/util | |
| parent | 5627fc68f60eb1362ff394930255dbb725a569b2 (diff) | |
| download | sqlalchemy-49d78c335403802b8035d0d6f61c92b3f7969174.tar.gz | |
Remove obsolete util.compat.nested
Fixes: #5177
Change-Id: Ie02b0c065e3833f43e056ad9c31f414871d9e8ee
Diffstat (limited to 'lib/sqlalchemy/util')
| -rw-r--r-- | lib/sqlalchemy/util/__init__.py | 1 | ||||
| -rw-r--r-- | lib/sqlalchemy/util/compat.py | 35 |
2 files changed, 0 insertions, 36 deletions
diff --git a/lib/sqlalchemy/util/__init__.py b/lib/sqlalchemy/util/__init__.py index b0ceb802a..b4610a1b0 100644 --- a/lib/sqlalchemy/util/__init__.py +++ b/lib/sqlalchemy/util/__init__.py @@ -58,7 +58,6 @@ from .compat import iterbytes # noqa from .compat import itertools_filter # noqa from .compat import itertools_filterfalse # noqa from .compat import namedtuple # noqa -from .compat import nested # noqa from .compat import next # noqa from .compat import parse_qsl # noqa from .compat import pickle # noqa diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index 8967955cd..104e8e03d 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -369,41 +369,6 @@ else: import collections as collections_abc # noqa -@contextlib.contextmanager -def nested(*managers): - """Implement contextlib.nested, mostly for unit tests. - - As tests still need to run on py2.6 we can't use multiple-with yet. - - Function is removed in py3k but also emits deprecation warning in 2.7 - so just roll it here for everyone. - - """ - - exits = [] - vars_ = [] - exc = (None, None, None) - try: - for mgr in managers: - exit_ = mgr.__exit__ - enter = mgr.__enter__ - vars_.append(enter()) - exits.append(exit_) - yield vars_ - except: - exc = sys.exc_info() - finally: - while exits: - exit_ = exits.pop() # noqa - try: - if exit_(*exc): - exc = (None, None, None) - except: - exc = sys.exc_info() - if exc != (None, None, None): - reraise(exc[0], exc[1], exc[2]) - - def raise_from_cause(exception, exc_info=None): if exc_info is None: exc_info = sys.exc_info() |
