Repository navigation
Conversation
Since pybind#5887 an enum with an unsigned underlying type compares unequal to numpy integers, because the no-convert pass rejects __index__ objects for unsigned targets and the catch-all overload returns false. Closes pybind#6192.
The no-convert early return was previously PyPy-only, so clang-tidy never saw it; readability-braces-around-statements now flags it.
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
A later PyPy GC at an arbitrary point can run the Python-calling destructor and abort. Assisted-by: ClaudeCode:claude-opus-5-5
Add uint_passthrough(_noconvert) and run the existing int conversion matrix against it, which also pins __index__ taking precedence over __int__ for unsigned targets. Gate the explicit PyNumber_Index call on PYBIND11_INDEX_CHECK so objects without __index__ no longer raise and clear an extra TypeError in convert mode, and select the PyPy/unsigned condition with a constexpr bool instead of two #if'd if-heads. Assisted-by: ClaudeCode:claude-fable-5-1
PyLong_AsUnsignedLong does not call __int__, so the unsigned caster falls back to PyNumber_Long and does not warn. Assisted-by: ClaudeCode:claude-opus-5-5
PyPy below the supported 7.3.17 is not a target, and supported PyPy calls __index__ in PyLong_AsLong[Long] like CPython, so only unsigned targets need the explicit PyNumber_Index call. Also drops the complex.h comment that pointed at the removed branch. Assisted-by: ClaudeCode:claude-opus-5-5
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.
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.
Keep complex instances and __complex__ methods ahead of the legacy __index__ fallback. Retain support for older PyPy versions and update the workaround comment. Add regression coverage for mixed protocols, complex subclasses, and failing __complex__ methods. Assisted-by: Codex
Keep a pinned PyPy 7.3.23 / Python 3.11 job alongside the PyPy 8 matrix while PyPy 7 remains supported. Assisted-by: Codex
NOT FOR MERGING. Temporary integration branch to run CI on the combined changes from PR pybind#6193 and PR pybind#6197. Assisted-by: Codex
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOT FOR MERGING. This PR exists only to run CI on the combined changes from #6193 and #6197.
The integration branch starts at #6193 and merges #6197 into it:
78c91af8396e9db3de71c29e7f37961635cb8d813d087e14196e3d8226c36aeed65316cc98d149a7This includes the restored Linux PyPy 7.3.23 / Python 3.11 job alongside the PyPy 8 jobs. Neither original PR branch is changed by this integration merge.
The PR is intentionally not a draft because this repository skips much of its CI matrix for draft PRs. Do not merge this PR.
Local validation: the branches merged without conflicts,
git diff --checkpassed, andprek -a --quietpassed. CI results are left for manual review.No changelog entry is needed for this temporary CI-only PR.