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: compile traceback must include filename
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: jhylton, theller
Priority: normal Keywords:

Created on 2002-06-05 17:09 by theller, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff theller, 2002-07-04 08:38 Patch including test case
compile-patch2.diff theller, 2002-07-05 07:01 Patch without PyParser_ParseStringFilename()
Messages (8)
msg11060 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-06-05 17:09
> >>> compile("1+*3", "myfile.py", "exec")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "<string>", line 1
>     1+*3
>       ^
> SyntaxError: invalid syntax
> >>>
> 
> Shouldn't it print "myfile.py" instead of "<string>"?

Yes.

--Guido van Rossum 
msg11061 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-06-05 18:57
Logged In: YES 
user_id=11105

To avoid any confusion: I (Thomas Heller) copied the 'Initial 
Comment' from a message posted to python-dev by Guido.
msg11062 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-07-04 08:40
Logged In: YES 
user_id=11105

I'm ready to work further on the patch. Comments appreciated!
msg11063 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-07-04 08:45
Logged In: YES 
user_id=11105

Uploaded patch. I had to create quite some new functions to 
pass the filename through all these calls. Maybe some 
functions could be replaced by macros?
msg11064 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-07-04 17:53
Logged In: YES 
user_id=31392

It is a maze of twisty little passages that all look alike 
<wink>.  I think there is no need for 
PyParser_ParseStringFilename().  Replace each use of it 
with a call to the Flags version that passes 0 for flags.

We should redo the entire API to have simpler names 
and avoid all the flags & ex stuff in the names.  Then we 
could write a compat layer that provides all the old 
names and calls the new functions.  But you can make 
that a separate patch <wink>.

msg11065 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-07-05 07:01
Logged In: YES 
user_id=11105

Ok, I created a second patch according to your suggestions: 
compile-patch2.diff.
msg11066 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-07-05 16:22
Logged In: YES 
user_id=31392

#2 Looks good.  Check it in but:

1) don't forget the test case from #1
2) be ure to wrap long lines
msg11067 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-07-09 09:25
Logged In: YES 
user_id=11105

Checked in and closed.
History
Date User Action Args
2022-04-10 16:05:23adminsetgithub: 36699
2002-06-05 17:09:47thellercreate