dispatchrun / dispatch-py

Python package to develop applications with Dispatch.
https://pypi.org/project/dispatch-py/
Apache License 2.0
56 stars 3 forks source link

Python 3.10 support #136

Closed chriso closed 7 months ago

chriso commented 7 months ago

This PR adds support for Python 3.10.

Versions prior to 3.11 have an additional stack of "blocks" on each frame that need to be persisted. We now store this information along with a "block pointer" so that we can later restore the frame properly.

In https://github.com/stealthrocket/dispatch-py/pull/136/commits/703f1e8c21c5bf86d569ee15af137d4297a6d2e2, I changed the extension so that it's more verbose when it comes to handling the differences across Python versions. Previously we were using macros with range checks, and aliasing fields that had the same structure but used different names across versions. Given the divergence in frame structures across Python 3.10 and 3.11, I felt it was better to be explicit and verbose when dealing with differences across versions. There'll now be a block of #if PY_MINOR_VERSION == N ... #elif PY_MINOR_VERSION == N+1 ... #elif PY_MINOR_VERSION == N+2 ... #endif each time something changes across versions, and there'll be a block for each version that we support. This should make it easier to add support for more versions (e.g. 3.9) and also deprecate versions in future.

This fixes #42.