[New-bugs-announce] [issue18331] runpy.run_path gives functions with corrupted .__globals__

Drekin report at bugs.python.org
Sun Jun 30 16:33:02 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue18331>
_______________________________________


More information about the New-bugs-announce mailing list