PyCon Israel 2022

πŸ‡ΊπŸ‡Έ Fine Grained Error Locations in Tracebacks
2022-06-29, 16:30–16:50, Main Hall

Python is dynamically typed. While awesome, even simple statements in a single line can cause series headaches. Running var['python']['3']['11']['a'] produced TypeError: 'NoneType' .. error. Impossible to debug from the Traceback, until 3.11..


A Python line can contains many operations e.g. in numpy -
result = (a + b) @ ( c + d)
If we will get an error, like broadcast error, the traceback will mention the Python line but won't be able to inform whether it originated from a + b or c + d.

Python is compiled to Bytecode (pyc files), which later interpretated to machine level. One Python line generates multiple bytecodes.

We will dive into Python's Bytecode, to understand how tracebacks work and why they were constrained to provide more information when bugs happen.

Those problems are solved in Python 3.11, released few weeks ago as alpha version. With it, the tracebacks now have markers that show exactly which variable caused the error. This feature reduce the use of debugging mode.


Session language – English Target audience – Developers