cfbraun / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Error line in trace back wrong in large functions #224

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run a function with more than 256 bytes of bytecode with a simple error such 
as misspelled variable name or import of unknown module late in the function.

What is the expected output? What do you see instead?
NameError File "blah.py", line 267, in myfunc 
but I see
NameError File "blah.py", line 105, in myfunc 

(and there's no context of which name was not found so it's hard to work out 
what's wrong, until editing the source around 105 made the error suspiciously 
point to a comment line)

What version of the product are you using? On what operating system?
pymite-09 
Windows and Desktop and maybe mbed

Please provide any additional information below.

Using tools/dismantle.py it became clear that the bytecode offset of the error 
is being used modulo 256 to find the corresponding line number so is way too 
early in the file.

It's due to the use of a uint8_t type for bcindex in plat.c/plat.cpp 
plat_reportError walking the line number table (same code across various ports).

Make bcindex 16bit and it'll be right for functions with 64K of bytecode; that 
should be enough for most sensible Python.

Original issue reported on code.google.com by david.ea...@googlemail.com on 9 Feb 2012 at 10:18

GoogleCodeExporter commented 9 years ago
I think better NameError context is Issue 155

Original comment by david.ea...@googlemail.com on 9 Feb 2012 at 10:22

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 5765fd0baabf.

Original comment by dwhall...@gmail.com on 20 Feb 2012 at 6:50

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 20 Feb 2012 at 7:01