fix: support PyPy 8.0.0 (3.11 and 3.12) (#6197)
* ci: test PyPy 8.0.0 (3.11 and 3.12)
Fix two problems found with PyPy 3.12:
- Deallocating a py::dynamic_attr() instance aborted, because PyPy 3.12's
_PyObject_GetDictPtr() cannot be called from tp_dealloc. Read the dict
slot from tp_dictoffset on PyPy instead.
- memoryview::from_buffer() passed temporary shape/strides arrays, which
PyPy keeps without copying. Use PyPy's inline _shape/_strides arrays.
Assisted-by: ClaudeCode:claude-opus-5-5
* tests: collect PyPrintDestructor inside its test
A later PyPy GC at an arbitrary point can run the Python-calling destructor
and abort.
Assisted-by: ClaudeCode:claude-opus-5-5
* fix: limit PyPy dict deallocation workaround to 8.0.x
PyPy 8.0.1 fixes the deallocation bug, but 8.0.x releases share an
extension ABI. Retain the workaround throughout that minor series so
extensions built with newer headers can still run on 8.0.0.
Register PYPY_VERSION_NUM with the inline-header configuration checker.
* ci: test PyPy 8.0.1 while retaining 8.0.0 regression coverage
Update the Linux Python 3.11 and macOS Python 3.12 jobs to PyPy 8.0.1.
Keep Linux Python 3.12 on 8.0.0 to exercise the deallocation and memoryview
workarounds without adding jobs.
* ci: retain a PyPy 7 Linux job
Keep a pinned PyPy 7.3.23 / Python 3.11 job alongside the PyPy 8 matrix while PyPy 7 remains supported.
Assisted-by: Codex
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
7 files changed