commit: bb9fa113039738e8ae6c31f8882d45065b19c851
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 20 13:53:54 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 20 17:09:01 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb9fa113
dev-python/pybind11: Enable pypy3.11
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
.../pybind11/files/pybind11-2.13.6-pypy311.patch | 31 ++++++++++++++++++++++
dev-python/pybind11/pybind11-2.13.6.ebuild | 12 +++++++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dev-python/pybind11/files/pybind11-2.13.6-pypy311.patch
b/dev-python/pybind11/files/pybind11-2.13.6-pypy311.patch
new file mode 100644
index 000000000000..debc7b7c55e2
--- /dev/null
+++ b/dev-python/pybind11/files/pybind11-2.13.6-pypy311.patch
@@ -0,0 +1,31 @@
+diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h
+index 1044db94..89d418cc 100644
+--- a/include/pybind11/attr.h
++++ b/include/pybind11/attr.h
+@@ -351,7 +351,8 @@ struct type_record {
+
+ bases.append((PyObject *) base_info->type);
+
+-#if PY_VERSION_HEX < 0x030B0000
++// Keep in sync with enable_dynamic_attributes() in detail/class.h
++#if PY_VERSION_HEX < 0x030B0000 || defined(PYPY_VERSION)
+ dynamic_attr |= base_info->type->tp_dictoffset != 0;
+ #else
+ dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT)
!= 0;
+diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h
+index b990507d..e97d48b2 100644
+--- a/include/pybind11/detail/class.h
++++ b/include/pybind11/detail/class.h
+@@ -560,9 +560,9 @@ extern "C" inline int pybind11_clear(PyObject *self) {
+ inline void enable_dynamic_attributes(PyHeapTypeObject *heap_type) {
+ auto *type = &heap_type->ht_type;
+ type->tp_flags |= Py_TPFLAGS_HAVE_GC;
+-#if PY_VERSION_HEX < 0x030B0000
+- type->tp_dictoffset = type->tp_basicsize; // place dict at the
end
+- type->tp_basicsize += (ssize_t) sizeof(PyObject *); // and allocate
enough space for it
++#if PY_VERSION_HEX < 0x030B0000 || defined(PYPY_VERSION) // For PyPy see PR
#5508
++ type->tp_dictoffset = type->tp_basicsize; // place dict at the
end
++ type->tp_basicsize += (ssize_t) sizeof(PyObject *); // and allocate
enough space for it
+ #else
+ type->tp_flags |= Py_TPFLAGS_MANAGED_DICT;
+ #endif
diff --git a/dev-python/pybind11/pybind11-2.13.6.ebuild
b/dev-python/pybind11/pybind11-2.13.6.ebuild
index 7f5daedfa762..dea8590f1058 100644
--- a/dev-python/pybind11/pybind11-2.13.6.ebuild
+++ b/dev-python/pybind11/pybind11-2.13.6.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..13} pypy3 )
+PYTHON_COMPAT=( python3_{10..13} pypy3 pypy3_11 )
inherit cmake distutils-r1
@@ -39,7 +39,15 @@ EPYTEST_XDIST=1
distutils_enable_tests pytest
python_prepare_all() {
+ local PATCHES=(
+ # https://github.com/pybind/pybind11/pull/5508
+ # https://github.com/pybind/pybind11/pull/5537
+ "${FILESDIR}/${P}-pypy311.patch"
+ )
+
cmake_src_prepare
+
+ PATCHES=()
distutils-r1_python_prepare_all
}