Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore compatibility with Python 3.11 #31

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Conversation

jhasse
Copy link
Contributor

@jhasse jhasse commented Jun 6, 2024

  • PyFrameObjects are now lazily allocated and no longer part of the PyThreadState. Therefore switch the _PyCFrame instead, but keep the PyFrameObject* for GC.

    python/cpython@ae0a2b7

  • The recursion_depth is no longer stored directly in the PyThreadState and needs to be calculated from recursion_remaining and recursion_limit.

    python/cpython@b931077

  • The exc_state was also simplified (no more exc_type and exc_traceback).

    python/cpython@396b583

  • Finally the frame "data stack" needs to be saved and restored. How this was done in python-greenlet was used as a reference.

    Restore compatibility with Python 3.11 python-greenlet/greenlet#280

  • Add new test test_clean_callstack to check that the call stack from the creation of the Fiber doesn't leak into it (i.e. tstate->cframe->current_frame = NULL; in stacklet__callback; tstate->frame = NULL; in older Python versions).

@saghul
Copy link
Owner

saghul commented Jun 6, 2024

Thank you!

@saghul
Copy link
Owner

saghul commented Jun 6, 2024

Can you rebase now please?

* PyFrameObjects are now lazily allocated and no longer part of the
  PyThreadState. Therefore switch the _PyCFrame instead, but keep the
  PyFrameObject* for GC.

  python/cpython@ae0a2b7

* The recursion_depth is no longer stored directly in the PyThreadState
  and needs to be calculated from recursion_remaining and
  recursion_limit.

  python/cpython@b931077

* The exc_state was also simplified (no more exc_type and
  exc_traceback).

  python/cpython@396b583

* Finally the frame "data stack" needs to be saved and restored. How this
  was done in python-greenlet was used as a reference.

  python-greenlet/greenlet#280

* Add new test test_clean_callstack to check that the call stack from
  the creation of the Fiber doesn't leak into it (i.e.
  `tstate->cframe->current_frame = NULL;` in `stacklet__callback`;
  `tstate->frame = NULL;` in older Python versions).
@jhasse
Copy link
Contributor Author

jhasse commented Jun 6, 2024

done.

btw. Python 3.12 coming up next :)

@saghul saghul merged commit ce76162 into saghul:master Jun 6, 2024
17 checks passed
@saghul
Copy link
Owner

saghul commented Jun 6, 2024

Awesome!

@jhasse jhasse deleted the python-3.11 branch June 6, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants