This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python opens the ./ file on exception while using -c
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Traceback display code can attempt to open a file named "<stdin>"
View: 1514420
Assigned To: Nosy List: iritkatriel, mdk
Priority: normal Keywords:

Created on 2021-10-24 09:38 by mdk, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg404922 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2021-10-24 09:38
When running `python -c 'raise ValueError'` Python tries to open the '<string>' file, so:

    $ echo Coucou > '<string>'
    $ python -c 'raise ValueError'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
        Coucou
    ValueError
msg404941 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-10-24 21:02
Can you check on 3.11? I believe it was fixed under issue1514420.
msg404943 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-10-24 21:06
Actually I can check too :)

And it was fixed:

iritkatriel@Irits-MBP cpython % echo Coucou > '<string>'
iritkatriel@Irits-MBP cpython % ./python.exe -c 'raise ValueError'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError
iritkatriel@Irits-MBP cpython %
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89759
2021-10-24 21:07:28iritkatrielsetstatus: open -> closed
stage: resolved
2021-10-24 21:06:00iritkatrielsetmessages: + msg404943
2021-10-24 21:02:13iritkatrielsetnosy: + iritkatriel
messages: + msg404941
resolution: duplicate

superseder: Traceback display code can attempt to open a file named "<stdin>"
2021-10-24 09:38:17mdkcreate