summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/lambdas.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/lambdas.py')
-rw-r--r--lib/sqlalchemy/sql/lambdas.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py
index d71c85d60..ae7358870 100644
--- a/lib/sqlalchemy/sql/lambdas.py
+++ b/lib/sqlalchemy/sql/lambdas.py
@@ -6,6 +6,7 @@
# the MIT License: https://www.opensource.org/licenses/mit-license.php
import collections.abc as collections_abc
+import inspect
import itertools
import operator
import types
@@ -618,6 +619,10 @@ class AnalyzedCode:
return analyzed
def __init__(self, fn, lambda_element, opts):
+ if inspect.ismethod(fn):
+ raise exc.ArgumentError(
+ "Method %s may not be passed as a SQL expression" % fn
+ )
closure = fn.__closure__
self.track_bound_values = (