Mark Shannon <m...@hotpy.org> added the comment:

This change combines the explicit state in `PyFrameObject.f_excuting` and 
`PyGenObject.gi_running`, and the implicit state in `PyFrameObject.f_stacktop 
== NULL` and `PyFrameObject.f_last == -1` into a single enum field in 
`PyFrameObject`.

Since we no longer need to test `PyFrameObject.f_stacktop == NULL` , The 
`f_stacktop` pointer can be replaced with a `f_stackdepth` integer, which make 
for simpler code when iterating over the stack and avoids the potential hazard 
of NULL pointers.

There are  three benefits to these changes:

1. The code is more robust and, IMO, easier to understand, as all state is now 
explicit.
2. It carries additional information about the state of the frame. Information 
about whether a frame exiting by `return` or by `raise` is available.
3. A modest reduction in size of frame and generator objects.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40941>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to