Python Forum
traceback reports "wrong" file and line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
traceback reports "wrong" file and line
#6
(Nov-20-2019, 09:03 AM)perfringo Wrote: I can quite clearly see that this is 'line 1' Smile

But on more serious note - what should be desired behaviour?

desired behavior should be something that (also) indicates the name of the file and line number the f'string is on. it could do this in much the same way it shows where a function was called from or where a module was imported from. the guts of a f-string seem to be compiled like code. i don't know how that gets put together but it is obvious that the f-string gets constructed into a regular string at the point where the f-string appeared in the source code (as executed). hypothetically, an f-string could even appear inside an f-string (i've never tried this, but maybe i should). there should be a stack of data items showing where the code is invoked, which in the case of f-strings would also show where they are. that stack should (also) be shown at that point in the traceback dump. if that information is not recorded, then it should be.

within an f-string there are zero or more clauses within {} that should be enumerated so that which an error exists in (whether detected at compile time or at run time) can be revealed as part of the error traceback. in the case of an f-string inside an f-string (i don't know, yet, if this is allowed), this could be a stack of enumerations identifying the nesting of f-strings (making it even easier to find which expression has the error).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: traceback reports "wrong" file and line - by Skaperen - Nov-21-2019, 07:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb traceback and multi-line statement Skaperen 0 890 Jan-31-2023, 12:23 AM
Last Post: Skaperen
  a program i want: file line slicing Skaperen 4 3,317 Dec-19-2018, 01:47 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020