New submission from jbeulich <jbeul...@novell.com>: Due to the way PySys_SetArgv() works, when the initial script is a symbolic link, importing from normal files in the same directory does not work. This is particularly surprising when the work tree is a symlinked clone (cp -s) of an original (i.e. snapshot) tree with a few modifications (patches) applied to one or more of the modules imported from: Due the the erratum, the modifications made will appear to not take effect until one realizes that the wrong module is being imported from.
The solution would in my opinion be to not only add the path left after the readlink()/realpath() processing to the import search path list, but also any intermediately encountered ones (in the order processed) as long as the leaf component continues to be a symlink. (Note: It seems pointless to use readlink() in the current [3.1 and earlier] implementation, since the result gets passed to realpath() anyway. Also, the documentation doesn't seem to mention this behavior, and from the sources it remains unclear why this processing is needed at all.) ---------- messages: 89914 nosy: jbeulich severity: normal status: open title: importing yields unexpected results when initial script is a symbolic link type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6386> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com