[Andrew Kuchling] > ... > It always seemed odd to me that the current line number is > always kept up to date, even though 99.999% of the time, no > one will care. Why not just keep a small table that holds > the offset in the bytecode at which each line starts, and > look it up when it's needed? As Guido said, we already do -- indeed, that's how Python manages to produce line numbers in tracebacks under -O mode (which inhibits generation of SET_LINENO opcodes). Your next job <wink> is to think about how, e.g., you can set a breakpoint on a specific line of code in the debugger. Take a quick peek at the implementation of SET_LINENO in ceval.c, and you'll see that's where the trace hook is implemented. No SET_LINENO, no trace callback. That's what Vladimir has been trying to solve: the trick is arranging to pay something at runtime for it only when you're actually using it. debuggers-always-need-dirty-tricks-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4