summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/lambdas.py
diff options
context:
space:
mode:
authorMartin Häcker <mhaecker@mac.com>2021-03-23 11:46:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-03-23 13:56:36 -0400
commitae867bf0cbdbb935742d8cb22e1b76136b77965c (patch)
tree22101036009c0578e8c0fdf4c95db800654e0e9b /lib/sqlalchemy/sql/lambdas.py
parent8bf920d52ddd4ec5f62a00fb9db370a076aa375d (diff)
downloadsqlalchemy-ae867bf0cbdbb935742d8cb22e1b76136b77965c.tar.gz
Use compat.exec_()
Fixed a bug where python 2.7.5 (default on CentOS 7) wasn't able to import sqlalchemy, because on this version of Python ``exec "statement"`` and ``exec("statement")`` do not behave the same way. The compatibility ``exec_()`` function was used instead. Fixes: #6069 Closes: #6112 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6112 Pull-request-sha: 4e951f9278eb462d1432a92b7bad93b973e4e2a5 Change-Id: I34e00250e874368e83c3e992be80e989a3c4f054
Diffstat (limited to 'lib/sqlalchemy/sql/lambdas.py')
-rw-r--r--lib/sqlalchemy/sql/lambdas.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py
index 2b77b8743..ebf576c8f 100644
--- a/lib/sqlalchemy/sql/lambdas.py
+++ b/lib/sqlalchemy/sql/lambdas.py
@@ -25,6 +25,7 @@ from .. import exc
from .. import inspection
from .. import util
from ..util import collections_abc
+from ..util import compat
_closure_per_cache_key = util.LRUCache(1000)
@@ -1064,7 +1065,7 @@ class AnalyzedFunction(object):
code += " return %s\n" % ", ".join("i%d" % i for i in argrange)
code += " return closure.__closure__"
vars_ = {"o%d" % i: cell_values[i] for i in argrange}
- exec(code, vars_, vars_)
+ compat.exec_(code, vars_, vars_)
closure = vars_["make_cells"]()
func = type(f)(