From 09e8c9240ca55a46104989229b1254aa349dac75 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 24 Apr 2012 19:15:00 -0400 Subject: [PATCH] py3k fixes --- lib/sqlalchemy/orm/util.py | 6 +++++- test/aaa_profiling/test_orm.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 5fcb15a9aa..684d96d2d4 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -759,7 +759,11 @@ def object_state(instance): """ try: return attributes.instance_state(instance) - except (exc.UnmappedClassError, exc.NO_STATE): + # TODO: whats the py-2/3 syntax to catch two + # different kinds of exceptions at once ? + except exc.UnmappedClassError: + raise exc.UnmappedInstanceError(instance) + except exc.NO_STATE: raise exc.UnmappedInstanceError(instance) diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 0049b4007d..5b32fc9e61 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -62,7 +62,7 @@ class MergeTest(fixtures.MappedTest): # bigger operation so using a small variance @profiling.function_call_count(variance=0.05, - versions={'2.7':85, '2.6':85, '2.5':94, '3': 83}) + versions={'2.7':85, '2.6':85, '2.5':94, '3': 95}) def go(): return sess2.merge(p1, load=False) p2 = go() @@ -70,7 +70,7 @@ class MergeTest(fixtures.MappedTest): # third call, merge object already present. almost no calls. @profiling.function_call_count(variance=0.05, - versions={'2.7':14, '2.6':14, '2.5':15, '3': 12}) + versions={'2.7':14, '2.6':14, '2.5':15, '3': 15}) def go(): return sess2.merge(p2, load=False) p3 = go() -- 2.47.3