Message354999
| Author |
ncoghlan |
| Recipients |
Michel Desmoulin, ncoghlan, r.david.murray, vstinner, xtreak, yselivanov |
| Date |
2019年10月20日.13:09:00 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1571576940.67.0.261573597148.issue20443@roundup.psfhosted.org> |
| In-reply-to |
| Content |
I think that's a valid point regarding sys.argv[0] - it's the import system and code introspection that wants(/needs) absolute paths, whereas sys.argv[0] gets used in situations (e.g. usage messages) where we should retain whatever the OS gave us, since that best reflects what the user entered.
That's straightforward to selectively revert, though: remove the "config->run_filename != NULL" clause at https://github.com/python/cpython/blob/24dc2f8c56697f9ee51a4887cf0814b6600c1815/Python/initconfig.c#L2201 and add a comment with the reason for the deliberate omission.
That way the OS-provided argv entry will continue to be passed through to sys.argv[0], while everywhere else will get the absolute path. |
|