diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-04 00:35:48 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-04 00:35:48 -0500 |
| commit | c450cd6cb6d0c8fed110abcec5bc17ec4e0e8c5e (patch) | |
| tree | 5123348a03368a518a08614bd195927cd7abf03a /lib/sqlalchemy/event | |
| parent | 31821011271bf2333b69954d53c3c922e39bf225 (diff) | |
| download | sqlalchemy-c450cd6cb6d0c8fed110abcec5bc17ec4e0e8c5e.tar.gz | |
- Fixed regression where using a ``functools.partial()`` with the event
system would cause a recursion overflow due to usage of inspect.getargspec()
on it in order to detect a legacy calling signature for certain events,
and apparently there's no way to do this with a partial object. Instead
we skip the legacy check and assume the modern style; the check itself
now only occurs for the SessionEvents.after_bulk_update and
SessionEvents.after_bulk_delete events. Those two events will require
the new signature style if assigned to a "partial" event listener.
[ticket:2905]
Diffstat (limited to 'lib/sqlalchemy/event')
| -rw-r--r-- | lib/sqlalchemy/event/attr.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/event/attr.py b/lib/sqlalchemy/event/attr.py index 690ebce08..f0fff5ca4 100644 --- a/lib/sqlalchemy/event/attr.py +++ b/lib/sqlalchemy/event/attr.py @@ -62,10 +62,15 @@ class _DispatchDescriptor(RefCollection): self._empty_listeners = weakref.WeakKeyDictionary() def _adjust_fn_spec(self, fn, named): - argspec = util.get_callable_argspec(fn, no_self=True) if named: fn = self._wrap_fn_for_kw(fn) - fn = legacy._wrap_fn_for_legacy(self, fn, argspec) + if self.legacy_signatures: + try: + argspec = util.get_callable_argspec(fn, no_self=True) + except ValueError: + pass + else: + fn = legacy._wrap_fn_for_legacy(self, fn, argspec) return fn def _wrap_fn_for_kw(self, fn): |
