diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-02 10:39:48 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-02 10:39:48 -0500 |
commit | 6750c39a4fc6be01502f3c9b1c6ba2d3f67a030e (patch) | |
tree | e9b70a288b8d8e09ad572da32900048436f8ebc3 /lib/sqlalchemy/sql/schema.py | |
parent | fa23570a338b53c813b6342fba0cacd4f5e61384 (diff) | |
download | sqlalchemy-6750c39a4fc6be01502f3c9b1c6ba2d3f67a030e.tar.gz |
- Fixed some test/feature failures occurring in Python 3.4,
in particular the logic used to wrap "column default" callables
wouldn't work properly for Python built-ins.
fixes #2979
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r-- | lib/sqlalchemy/sql/schema.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index a9d5a69b1..2614c08c8 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -27,6 +27,7 @@ Since these objects are part of the SQL expression language, they are usable as components in SQL expressions. """ +from __future__ import absolute_import import inspect from .. import exc, util, event, inspection @@ -41,6 +42,7 @@ from .selectable import TableClause import collections import sqlalchemy from . import ddl +import types RETAIN_SCHEMA = util.symbol('retain_schema') @@ -1844,7 +1846,12 @@ class ColumnDefault(DefaultGenerator): on everyone. """ - if inspect.isfunction(fn) or inspect.ismethod(fn): + # TODO: why aren't we using a util.langhelpers function + # for this? e.g. get_callable_argspec + + if isinstance(fn, (types.BuiltinMethodType, types.BuiltinFunctionType)): + return lambda ctx: fn() + elif inspect.isfunction(fn) or inspect.ismethod(fn): inspectable = fn elif inspect.isclass(fn): inspectable = fn.__init__ |