Message355278
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. |
|
Date |
User |
Action |
Args |
2019-10-24 05:46:47 | gregory.p.smith | set | recipients:
+ gregory.p.smith, ncoghlan, vstinner, r.david.murray, yselivanov, Michel Desmoulin, ammar2, xtreak |
2019-10-24 05:46:47 | gregory.p.smith | set | messageid: <1571896007.63.0.156491545939.issue20443@roundup.psfhosted.org> |
2019-10-24 05:46:47 | gregory.p.smith | link | issue20443 messages |
2019-10-24 05:46:47 | gregory.p.smith | create | |
|