diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2021-03-23 18:48:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-03-23 18:48:56 +0000 |
commit | a22b4dfbc44c78cb4fce27c33cf74cf57878a3b1 (patch) | |
tree | c3e5b9b50b53f23a9cf97bd7cd768353df6be000 | |
parent | 51bedc6751b440b51715420ca39c36fc6aea5349 (diff) | |
parent | ae867bf0cbdbb935742d8cb22e1b76136b77965c (diff) | |
download | sqlalchemy-a22b4dfbc44c78cb4fce27c33cf74cf57878a3b1.tar.gz |
Merge "Use compat.exec_()"
-rw-r--r-- | doc/build/changelog/unreleased_14/6069.rst | 8 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/lambdas.py | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_14/6069.rst b/doc/build/changelog/unreleased_14/6069.rst new file mode 100644 index 000000000..6cebdf44a --- /dev/null +++ b/doc/build/changelog/unreleased_14/6069.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, orm + :tickets: 6069 + + 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.
\ No newline at end of file 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)( |