diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2020-06-03 22:23:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-06-03 22:23:32 +0000 |
commit | 3b2c6692bd5df6fe4a37192dfdaed408e3be5e54 (patch) | |
tree | 582d2c0a3eb1929aeab303663756eb81cd822129 /lib | |
parent | 3f0735208d7c605669252abaf35c734b008b1b30 (diff) | |
parent | c516f607b616b2be606e418f17483afc1812782e (diff) | |
download | sqlalchemy-3b2c6692bd5df6fe4a37192dfdaed408e3be5e54.tar.gz |
Merge "Folds two identical exception handlers into a single one"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/orm/base.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/exc.py | 4 |
2 files changed, 2 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 77a85425e..54e45cd1a 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -319,11 +319,7 @@ def object_state(instance): def _inspect_mapped_object(instance): try: return instance_state(instance) - # TODO: whats the py-2/3 syntax to catch two - # different kinds of exceptions at once ? - except exc.UnmappedClassError: - return None - except exc.NO_STATE: + except (exc.UnmappedClassError,) + exc.NO_STATE: return None diff --git a/lib/sqlalchemy/orm/exc.py b/lib/sqlalchemy/orm/exc.py index 7b0f84866..19f8ca3bc 100644 --- a/lib/sqlalchemy/orm/exc.py +++ b/lib/sqlalchemy/orm/exc.py @@ -196,9 +196,7 @@ def _default_unmapped(cls): try: mappers = base.manager_of_class(cls).mappers - except NO_STATE: - mappers = {} - except TypeError: + except (TypeError,) + NO_STATE: mappers = {} name = _safe_cls_name(cls) |