diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-01 12:06:34 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-01 12:33:45 -0400 |
| commit | 95949db715ff54be01bfd260a51903ede60597ae (patch) | |
| tree | 926fadafe63839b78c472deae3c899b43b607acc /lib/sqlalchemy/ext/instrumentation.py | |
| parent | 635f06c3ebc787b98cf0ee1e94eff12fc96daff0 (diff) | |
| download | sqlalchemy-95949db715ff54be01bfd260a51903ede60597ae.tar.gz | |
- Repair _reinstall_default_lookups to also flip the _extended flag
off again so that test fixtures setup/teardown instrumentation as
expected
- clean up test_extendedattr.py and fix it to no longer leak
itself outside by ensuring _reinstall_default_lookups is always called,
part of #3408
- Fixed bug where when using extended attribute instrumentation system,
the correct exception would not be raised when :func:`.class_mapper`
were called with an invalid input that also happened to not
be weak referencable, such as an integer.
fixes #3408
Diffstat (limited to 'lib/sqlalchemy/ext/instrumentation.py')
| -rw-r--r-- | lib/sqlalchemy/ext/instrumentation.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/instrumentation.py b/lib/sqlalchemy/ext/instrumentation.py index 024136661..30a0ab7d7 100644 --- a/lib/sqlalchemy/ext/instrumentation.py +++ b/lib/sqlalchemy/ext/instrumentation.py @@ -166,7 +166,13 @@ class ExtendedInstrumentationRegistry(InstrumentationFactory): def manager_of_class(self, cls): if cls is None: return None - return self._manager_finders.get(cls, _default_manager_getter)(cls) + try: + finder = self._manager_finders.get(cls, _default_manager_getter) + except TypeError: + # due to weakref lookup on invalid object + return None + else: + return finder(cls) def state_of(self, instance): if instance is None: @@ -392,6 +398,7 @@ def _reinstall_default_lookups(): manager_of_class=_default_manager_getter ) ) + _instrumentation_factory._extended = False def _install_lookups(lookups): |
