]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Use compat.exec_()
authorMartin Häcker <mhaecker@mac.com>
Tue, 23 Mar 2021 15:46:18 +0000 (11:46 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Mar 2021 17:56:36 +0000 (13:56 -0400)
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

doc/build/changelog/unreleased_14/6069.rst [new file with mode: 0644]
lib/sqlalchemy/sql/lambdas.py

diff --git a/doc/build/changelog/unreleased_14/6069.rst b/doc/build/changelog/unreleased_14/6069.rst
new file mode 100644 (file)
index 0000000..6cebdf4
--- /dev/null
@@ -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
index 2b77b8743ff02454b5ac9dbc2a0e17c39ae62185..ebf576c8f2e48a58334c89ce1aa2918848002d04 100644 (file)
@@ -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)(