Fine Grained Error Locations in Tracebacks
summary
Python 3.11 embeds fine-grained error location metadata in bytecode so tracebacks show exact column positions inside a source line, not just the line number, and those markers propagate up the call stack to identify which sub-expression raised the exception. Implementation adds two column offsets to pyc/pycache files, reducing time spent opening debuggers or adding prints but increasing storage; a pyc metadata opt-out flag lets builds skip the extra data.
AI-written summary · about
chapters (9)
- 0:00Introduction to Python 3.11
- 2:38Motivation for fine-grained errors
- 8:51How Python tracebacks work
- 12:23Fine-grained error location feature
- 14:15Memory cost and opt-out option
- 15:42Example with dictionary access
- 17:09Error markers in call stack
- 17:51Summary and benefits
- 18:55Q&A about memory impact
related talks
26mMaking Python better one error message at a time
23mTrace functions: Building a tiny debugger
28mWhat makes a Python debugger possible and how can we make it 100x faster
30mPython 3.12's new monitoring and debugging API
27mThe Hidden Power of the Python Runtime
40mDebugging PySpark - Pretending to make sense of JVM stack traces
06mImproving Debuggability with GDB's Python API
26mDebugging PySpark -- Or trying to make sense of a JVM stack trace when you were minding your own bus
