From 665b92d83f3a93d8df54338a35f2b3e70e7f21a0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 14 Oct 2016 13:26:35 -0400 Subject: Check for __module__ not present in util.wrap_callable() The newly added wrap_callable() function assumes __module__ is present when this is not the case for objects such as functools.partial. Change-Id: Ia226260e9a65419e26d5c1f7187512f7fd4bb7c1 Fixes: #3823 --- lib/sqlalchemy/util/langhelpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 4675f7cdb..f2ca80664 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -1398,7 +1398,8 @@ def wrap_callable(wrapper, fn): else: _f = wrapper _f.__name__ = fn.__class__.__name__ - _f.__module__ = fn.__module__ + if hasattr(fn, '__module__'): + _f.__module__ = fn.__module__ if hasattr(fn.__call__, '__doc__') and fn.__call__.__doc__: _f.__doc__ = fn.__call__.__doc__ -- cgit v1.2.1