[issue22121] Start IDLE from icon in a better place.
Terry J. Reedy
report at bugs.python.org
Tue Jul 16 17:18:40 EDT 2019
Terry J. Reedy <tjreedy at udel.edu> added the comment:
An implementation note mostly to myself: In 3.8 and before, 'python relative/path/to/file.py' results in the __file__ attribute of the main module being the relative path, and a possibly unnormalized full path is os.curdir + __file__. I believe that this is the only situation in which __file__ is not absolute. After os.chdir(new cwd), relative __file__ becomes useless unless the original curdir is saved or __file__ is made absolute first. The startup part of pyshell has this vulnerable line.
icondir = os.path.join(os.path.dirname(__file__), 'Icons')
But with curdir left alone when starting from a command line, there will be no problem.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22121>
_______________________________________
More information about the Python-bugs-list
mailing list