New submission from Drekin:
Let's have a simple script test.py:
def f():
return x
x = 2
print(f())
Now if we try to run it via runpy.run_path, we get the following:
>>> import runpy
>>> g = runpy.run_path("test.py")
2
>>> g["f"]() is None
True
>>> g["x"] is 2
True
>>> g["f"].__globals__["x"] is None
True
Is the behaviour of f.__globals__ after return from run_path intended and why?
----------
components: Library (Lib)
messages: 192072
nosy: Drekin
priority: normal
severity: normal
status: open
title: runpy.run_path gives functions with corrupted .__globals__
type: behavior
versions: Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18331>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com