We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
pm.exec
eval
1 parent c4d9405 commit 3e2aad2Copy full SHA for 3e2aad2
python/pythonmonkey/require.py
@@ -84,10 +84,8 @@
84
globalThis.python.stderr.read = lambda n: sys.stderr.read(n)
85
# Python 3.13 dramatically changed how the namespace in `exec`/`eval` works
86
# See https://docs.python.org/3.13/whatsnew/3.13.html#defined-mutation-semantics-for-locals
87
-_locals = {} # keep the local variables inside `eval`/`exec` to a dict
88
-globalThis.python.eval = lambda x: eval(x, None, _locals)
89
-globalThis.python.exec = lambda x: exec(x, None, _locals)
90
-globalThis.python.getenv = os.getenv
+globalThis.python.eval = lambda x: eval(x, None, sys._getframe(1).f_locals)
+globalThis.python.exec = lambda x: exec(x, None, sys._getframe(1).f_locals)
91
globalThis.python.paths = sys.path
92
93
globalThis.python.exit = pm.eval("""'use strict';
0 commit comments