bpo-20443: _PyConfig_Read() gets the absolute path of run_filename#14053
Merged
vstinner merged 2 commits intopython:masterfrom Jun 25, 2019
vstinner:run_filename_abspath
Merged
bpo-20443: _PyConfig_Read() gets the absolute path of run_filename#14053vstinner merged 2 commits intopython:masterfrom vstinner:run_filename_abspath
vstinner merged 2 commits intopython:masterfrom
vstinner:run_filename_abspath
Conversation
Member
Author
|
@1st1: This change covers your example described in https://bugs.python.org/issue20443 Would you mind to have a look? |
Member
Author
|
@ncoghlan: Does this change seem reasonable to you? Effect of my PR 14053 using script.py: Before: With this change: |
Python now gets the absolute path of the script filename specified on the command line (ex: "python3 script.py"): the __file__ attribute of the __main__ module and sys.path[0] become an absolute path, rather than a relative path. * Add _Py_isabs() and _Py_abspath() functions. * _PyConfig_Read() now tries to get the absolute path of run_filename, but keeps the relative path if _Py_abspath() fails. * Reimplement os._getfullpathname() using _Py_abspath(). * Use _Py_isabs() in getpath.c
lisroach
pushed a commit
to lisroach/cpython
that referenced
this pull request
Sep 10, 2019
…ythonGH-14053) Python now gets the absolute path of the script filename specified on the command line (ex: "python3 script.py"): the __file__ attribute of the __main__ module, sys.argv[0] and sys.path[0] become an absolute path, rather than a relative path. * Add _Py_isabs() and _Py_abspath() functions. * _PyConfig_Read() now tries to get the absolute path of run_filename, but keeps the relative path if _Py_abspath() fails. * Reimplement os._getfullpathname() using _Py_abspath(). * Use _Py_isabs() in getpath.c.
DinoV
pushed a commit
to DinoV/cpython
that referenced
this pull request
Jan 14, 2020
…ythonGH-14053) Python now gets the absolute path of the script filename specified on the command line (ex: "python3 script.py"): the __file__ attribute of the __main__ module, sys.argv[0] and sys.path[0] become an absolute path, rather than a relative path. * Add _Py_isabs() and _Py_abspath() functions. * _PyConfig_Read() now tries to get the absolute path of run_filename, but keeps the relative path if _Py_abspath() fails. * Reimplement os._getfullpathname() using _Py_abspath(). * Use _Py_isabs() in getpath.c.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python now gets the absolute path of the script filename specified on
the command line (ex: "python3 script.py"): the file attribute of
the main module and sys.path[0] become an absolute path, rather
than a relative path.
run_filename, but keeps the relative path if _Py_abspath() fails.
https://bugs.python.org/issue20443