New submission from Nick Coghlan <ncogh...@gmail.com>:

Directory setup: linkdir is a symlink to realdir

$ python3 -c "import sys; sys.path.insert(0, 'linkdir'); import runpy; 
print(runpy.run_module('foo')['__file__'])"
/home/ncoghlan/devel/play/realdir/foo.py
$ ../py3k/python -c "import sys; sys.path.insert(0, 'linkdir'); import runpy; 
print(runpy.run_module('foo')['__file__'])"
/home/ncoghlan/devel/play/linkdir/foo.py

The culprit is pkgutil - the import emulation includes a realpath() call. 
Looking at the log, this dates from PJE's consolidation of the various import 
emulations back in 2006, with no specific rationale given.

Since this was only in the emulation, and nothing else broke when we took it 
out (indeed, it was the cause of test failures in 3.2, when it altered the 
__file__ values in ways the test wasn't expecting), I'm just creating and 
closing this issue to note that yes, I'm aware this has changed, but no, I 
don't consider it a problem, as it just brings pkgutil into line with the 
behaviour of normal imports.

----------
messages: 165754
nosy: brett.cannon, georg.brandl, ncoghlan
priority: normal
severity: normal
status: open
title: Behaviour change in runpy for __file__ attributes between 3.2 and 3.3
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15385>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to