summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-06-03 22:23:32 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-06-03 22:23:32 +0000
commit3b2c6692bd5df6fe4a37192dfdaed408e3be5e54 (patch)
tree582d2c0a3eb1929aeab303663756eb81cd822129 /lib
parent3f0735208d7c605669252abaf35c734b008b1b30 (diff)
parentc516f607b616b2be606e418f17483afc1812782e (diff)
downloadsqlalchemy-3b2c6692bd5df6fe4a37192dfdaed408e3be5e54.tar.gz
Merge "Folds two identical exception handlers into a single one"
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/base.py6
-rw-r--r--lib/sqlalchemy/orm/exc.py4
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)