devguide icon indicating copy to clipboard operation
devguide copied to clipboard

Resolve TODO's in the bytecode interpreter section

Open Christopher-Chianelli opened this issue 2 years ago • 2 comments

Describe the enhancement or feature you'd like The documentation for the bytecode interpreter has a variety of TODO's: https://devguide.python.org/internals/interpreter/:

  • Exception chaining > Other exception details.
  • The call stack > Also frame layout and use, and “locals plus”.
  • All sorts of variables > Write the rest of this section. Alas, the author got distracted and won’t have time to continue this for a while.

Additionally, some TODO's correspond to new sections that need to be created:

  • co_consts, co_names, co_varnames, and their ilk
  • How calls work (how args are transferred, return, exceptions)
  • Generators, async functions, async generators, and yield from (next, send, throw, close; and await; and how this code breaks the interpreter abstraction)
  • Eval breaker (interrupts, GIL)
  • Tracing
  • Setting the current lineno (debugger-induced jumps)
  • Specialization, inline caches etc. (outdated? There is https://devguide.python.org/internals/interpreter/#inline-cache-entries)

Completing these TODO's would make the bytecode interpreter section of the devguide more complete, reducing the variety of places that need to be searched in order to understand how the interpreter works.

Describe alternatives you've considered Remove the TODO's and leave the rest of the documentation as is (Status Quo).

Additional context A guide to "All sorts of variables" I found useful when implementing my own bytecode interpreter:

  • https://tenthousandmeters.com/blog/python-behind-the-scenes-5-how-variables-are-implemented-in-cpython/ (All sorts of variables)

Christopher-Chianelli avatar Apr 17 '23 23:04 Christopher-Chianelli

PRs would be very welcome. Guido (the author) ran out of time/energy and published what he had, see the original PR.

encukou avatar Apr 18 '23 09:04 encukou

Hey, I would love to work on this issue.

Lincoln-developer avatar Nov 14 '23 14:11 Lincoln-developer