[Sqlalchemy-tickets] [sqlalchemy] #2905: Attempting to use a partial() instance as an event listene
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-01-04 04:16:26
|
#2905: Attempting to use a partial() instance as an event listener causes infinite
recursion
-----------------------+-----------------------------------------
Reporter: agronholm | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-----------------------+-----------------------------------------
I had this line in my app fail due to infinite recursion:
{{{
event.listen(session, 'after_commit', partial(self.publish_events,
models=tuple(models_changed)))
}}}
This is a regression from 0.8.4. I haven't tested with 0.9.0b1.
The simplest way to reproduce this is:
{{{
>>> from functools import partial
>>> from sqlalchemy.util import get_callable_argspec
>>> p = partial(print, 'b')
>>> get_callable_argspec(p)
....
File "/home/alex/virtualenv/triancore/lib/python3.3/site-
packages/sqlalchemy/util/langhelpers.py", line 272,
in get_callable_argspec
return get_callable_argspec(fn.__call__)
File "/home/alex/virtualenv/triancore/lib/python3.3/site-
packages/sqlalchemy/util/langhelpers.py", line 264,
in get_callable_argspec
if isinstance(fn, types.FunctionType):
RuntimeError: maximum recursion depth exceeded while calling a Python
object
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2905>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|