summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>2021-12-14 10:23:20 +0100
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2021-12-14 14:29:03 +0100
commitbba9d681e57794f6a466a3796a489e256ca16a1b (patch)
treecc37772bd2843a39a8ed8ca733ec9447e41df07b /dev-python/shiboken2
parentdev-libs/plasma-wayland-protocols: Drop 1.3.0 (diff)
downloadgentoo-bba9d681e57794f6a466a3796a489e256ca16a1b.tar.gz
gentoo-bba9d681e57794f6a466a3796a489e256ca16a1b.tar.bz2
gentoo-bba9d681e57794f6a466a3796a489e256ca16a1b.zip
dev-python/shiboken2: patch and enable python3.10
Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'dev-python/shiboken2')
-rw-r--r--dev-python/shiboken2/files/shiboken2-5.15.2-python310.patch104
-rw-r--r--dev-python/shiboken2/shiboken2-5.15.2-r1.ebuild3
2 files changed, 106 insertions, 1 deletions
diff --git a/dev-python/shiboken2/files/shiboken2-5.15.2-python310.patch b/dev-python/shiboken2/files/shiboken2-5.15.2-python310.patch
new file mode 100644
index 000000000000..c4f582ff71de
--- /dev/null
+++ b/dev-python/shiboken2/files/shiboken2-5.15.2-python310.patch
@@ -0,0 +1,104 @@
+diff -upr libshiboken/pep384impl.cpp libshiboken/pep384impl.cpp
+--- a/libshiboken/pep384impl.cpp 2020-11-11 14:51:30.000000000 +0200
++++ b/libshiboken/pep384impl.cpp 2021-12-01 15:17:21.444888977 +0200
+@@ -751,14 +751,14 @@ _Pep_PrivateMangle(PyObject *self, PyObj
+ #endif // IS_PY2
+ Shiboken::AutoDecRef privateobj(PyObject_GetAttr(
+ reinterpret_cast<PyObject *>(Py_TYPE(self)), Shiboken::PyMagicName::name()));
+-#ifndef Py_LIMITED_API
+- return _Py_Mangle(privateobj, name);
+-#else
+- // For some reason, _Py_Mangle is not in the Limited API. Why?
+- size_t plen = PyUnicode_GET_LENGTH(privateobj);
++
++ // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always.
++ // The rest of this function is our own implementation of _Py_Mangle.
++ // Please compare the original function in compile.c .
++ size_t plen = PyUnicode_GET_LENGTH(privateobj.object());
+ /* Strip leading underscores from class name */
+ size_t ipriv = 0;
+- while (PyUnicode_READ_CHAR(privateobj, ipriv) == '_')
++ while (PyUnicode_READ_CHAR(privateobj.object(), ipriv) == '_')
+ ipriv++;
+ if (ipriv == plen) {
+ Py_INCREF(name);
+@@ -787,7 +787,6 @@ _Pep_PrivateMangle(PyObject *self, PyObj
+ if (amount > big_stack)
+ free(resbuf);
+ return result;
+-#endif // else Py_LIMITED_API
+ }
+
+ /*****************************************************************************
+diff -upr libshiboken/pep384impl.h libshiboken/pep384impl.h
+--- a/libshiboken/pep384impl.h 2020-11-11 14:51:30.000000000 +0200
++++ b/libshiboken/pep384impl.h 2021-12-01 15:13:58.899521842 +0200
+@@ -40,6 +40,11 @@
+ #ifndef PEP384IMPL_H
+ #define PEP384IMPL_H
+
++// PYSIDE-1436: Adapt to Python 3.10
++#if PY_VERSION_HEX < 0x030900A4
++# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
++#endif
++
+ extern "C"
+ {
+
+@@ -327,7 +332,7 @@ LIBSHIBOKEN_API PyObject *PyRun_String(c
+ // But this is no problem as we check it's validity for every version.
+
+ #define PYTHON_BUFFER_VERSION_COMPATIBLE (PY_VERSION_HEX >= 0x03030000 && \
+- PY_VERSION_HEX < 0x0309FFFF)
++ PY_VERSION_HEX < 0x030AFFFF)
+ #if !PYTHON_BUFFER_VERSION_COMPATIBLE
+ # error Please check the buffer compatibility for this python version!
+ #endif
+diff -upr libshiboken/sbkstring.cpp libshiboken/sbkstring.cpp
+--- a/libshiboken/sbkstring.cpp 2020-11-11 14:51:30.000000000 +0200
++++ b/libshiboken/sbkstring.cpp 2021-12-01 15:14:47.703201473 +0200
+@@ -247,7 +247,7 @@ static void finalizeStaticStrings()
+ {
+ auto &set = staticStrings();
+ for (PyObject *ob : set) {
+- Py_REFCNT(ob) = 1;
++ Py_SET_REFCNT(ob, 1);
+ Py_DECREF(ob);
+ }
+ set.clear();
+diff -upr shibokenmodule/files.dir/shibokensupport/signature/mapping.py shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+--- a/shibokenmodule/files.dir/shibokensupport/signature/mapping.py 2020-11-11 14:51:30.000000000 +0200
++++ b/shibokenmodule/files.dir/shibokensupport/signature/mapping.py 2021-12-01 15:15:14.560100869 +0200
+@@ -300,6 +300,7 @@ type_map.update({
+ "zero(object)": None,
+ "zero(str)": "",
+ "zero(typing.Any)": None,
++ "zero(Any)": None,
+ })
+
+ type_map.update({
+diff -upr shibokenmodule/files.dir/shibokensupport/signature/parser.py shibokenmodule/files.dir/shibokensupport/signature/parser.py
+--- a/shibokenmodule/files.dir/shibokensupport/signature/parser.py 2020-11-11 14:51:30.000000000 +0200
++++ b/shibokenmodule/files.dir/shibokensupport/signature/parser.py 2021-12-01 15:25:43.267843740 +0200
+@@ -43,10 +43,11 @@ import sys
+ import re
+ import warnings
+ import types
++import typing
+ import keyword
+ import functools
+ from shibokensupport.signature.mapping import (type_map, update_mapping,
+- namespace, typing, _NotCalled, ResultVariable, ArrayLikeVariable)
++ namespace, _NotCalled, ResultVariable, ArrayLikeVariable)
+ from shibokensupport.signature.lib.tool import (SimpleNamespace,
+ build_brace_pattern)
+
+@@ -222,7 +223,7 @@ def _resolve_arraytype(thing, line):
+ def to_string(thing):
+ if isinstance(thing, str):
+ return thing
+- if hasattr(thing, "__name__"):
++ if hasattr(thing, "__name__") and thing.__module__ != "typing":
+ dot = "." in str(thing)
+ name = get_name(thing)
+ return thing.__module__ + "." + name if dot else name
diff --git a/dev-python/shiboken2/shiboken2-5.15.2-r1.ebuild b/dev-python/shiboken2/shiboken2-5.15.2-r1.ebuild
index 662f2d9a55ae..46a0d6c37446 100644
--- a/dev-python/shiboken2/shiboken2-5.15.2-r1.ebuild
+++ b/dev-python/shiboken2/shiboken2-5.15.2-r1.ebuild
@@ -14,7 +14,7 @@ EAPI=7
# https://bugreports.qt.io/browse/PYSIDE-535
# Fails to compile with python3.10
# FAILED: libshiboken/CMakeFiles/libshiboken.dir/sbkstring.cpp.o
-PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_COMPAT=( python3_{8..10} )
inherit cmake llvm python-r1 toolchain-funcs
@@ -60,6 +60,7 @@ DEPEND="${RDEPEND}
"
DOCS=( AUTHORS )
+PATCHES=( "${FILESDIR}/${P}-python310.patch" )
# Ensure the path returned by get_llvm_prefix() contains clang as well.
llvm_check_deps() {