Gregory P. Smith <g...@krypto.org> added the comment:

Please revert.  An absolute path changes semantics in many real world 
situations (altering symlink traversals, etc).  People expect the current 
sys.argv[0] behavior which is "similar to C argv" and matches what was passed 
on the interpreter command line.

A getcwd() call doesn't even have to succeed.  A single file python program 
should still be able to run in that environment rather than fail to start.

To help address the original report filing issue, we could add a notion of 
.co_cwd to code objects for use in resolving co_filename.  Allow it to be '' if 
getcwd failed at source load time.  Code could check if co_cwd exists and join 
it with the co_filename.  Also let co_cwd remain empty when there is no valid 
co_filename for the code.

Preaching: Code that calls os.chdir() is always a potential problem as it 
alters process global state.  That call is best avoided as modifying globals is 
impolite.

----------
nosy: +gregory.p.smith
priority: normal -> release blocker

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

Reply via email to