dev-python/shiboken2: remove unused patches

Signed-off-by: Michael Mair-Keimberger <mmk@levelnine.at>
Portage 3.0.37 / pkgdev 0.2.2 / pkgcheck 0.10.15
Closes: https://github.com/gentoo/gentoo/pull/27425
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
This commit is contained in:
Michael Mair-Keimberger
2022-09-24 12:54:30 +02:00
committed by Andrew Ammerlaan
parent 9478d3bfc2
commit ca5f7bea47
4 changed files with 0 additions and 304 deletions
@@ -1,28 +0,0 @@
Backport of https://code.qt.io/cgit/pyside/pyside-setup.git/commit/?id=1422cf4a7f277fb13fd209f24a90d6c02641497d.
From 1422cf4a7f277fb13fd209f24a90d6c02641497d Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
Date: Thu, 23 Jun 2022 10:44:01 +0200
Subject: libshiboken: Fix build with numpy 1.23.0
Pick-to: 6.3 6.2 5.15
Change-Id: I885c332d6c948820140946c73ae1926e88834143
Reviewed-by: Christian Tismer <tismer@stackless.com>
--- a/libshiboken/sbknumpyarrayconverter.cpp
+++ b/libshiboken/sbknumpyarrayconverter.cpp
@@ -116,8 +116,13 @@ std::ostream &operator<<(std::ostream &str, PyArrayObject *o)
str << " NPY_ARRAY_NOTSWAPPED";
if ((flags & NPY_ARRAY_WRITEABLE) != 0)
str << " NPY_ARRAY_WRITEABLE";
- if ((flags & NPY_ARRAY_UPDATEIFCOPY) != 0)
- str << " NPY_ARRAY_UPDATEIFCOPY";
+#if NPY_VERSION >= 0x00000010 // NPY_1_23_API_VERSION
+ if ((flags & NPY_ARRAY_WRITEBACKIFCOPY) != 0)
+ str << " NPY_ARRAY_WRITEBACKIFCOPY";
+#else
+ if ((flags & NPY_ARRAY_UPDATEIFCOPY) != 0)
+ str << " NPY_ARRAY_UPDATEIFCOPY";
+#endif
} else {
str << '0';
}
@@ -1,104 +0,0 @@
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
@@ -1,47 +0,0 @@
The Fedora / upstream fixes (shiboken2-5.15.2-python311.patch) end up breaking
Python 3.8 compatibility (maybe 3.9 too, but didn't get that far).
Wrap them with PY_VERSION_HEX for Python 3.11.
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -366,7 +366,11 @@ SbkObjectType *SbkObject_TypeF(void)
static PyTypeObject *type = nullptr;
if (!type) {
type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&SbkObject_Type_spec));
- Py_SET_TYPE(type, SbkObjectType_TypeF());
+ #if PY_VERSION_HEX < 0x030B00A1
+ Py_TYPE(type) = SbkObjectType_TypeF();
+ #else
+ Py_SET_TYPE(type, SbkObjectType_TypeF());
+ #endif
Py_INCREF(Py_TYPE(type));
type->tp_weaklistoffset = offsetof(SbkObject, weakreflist);
type->tp_dictoffset = offsetof(SbkObject, ob_dict);
@@ -1110,7 +1114,11 @@ introduceWrapperType(PyObject *enclosingObject,
typeSpec->slots[0].pfunc = reinterpret_cast<void *>(baseType ? baseType : SbkObject_TypeF());
PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes);
- Py_SET_TYPE(heaptype, SbkObjectType_TypeF());
+ #if PY_VERSION_HEX < 0x030B00A1
+ Py_TYPE(heaptype) = SbkObjectType_TypeF();
+ #else
+ Py_SET_TYPE(heaptype, SbkObjectType_TypeF());
+ #endif
Py_INCREF(Py_TYPE(heaptype));
auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
#if PY_VERSION_HEX < 0x03000000
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -741,7 +741,11 @@ newTypeWithName(const char *name,
copyNumberMethods(numbers_fromFlag, newslots, &idx);
newspec.slots = newslots;
auto *type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&newspec));
- Py_SET_TYPE(type, SbkEnumType_TypeF());
+ #if PY_VERSION_HEX < 0x030B00A1
+ Py_TYPE(type) = SbkEnumType_TypeF();
+ #else
+ Py_SET_TYPE(type, SbkEnumType_TypeF());
+ #endif
auto *enumType = reinterpret_cast<SbkEnumType *>(type);
PepType_SETP(enumType)->cppName = cppName;
@@ -1,125 +0,0 @@
https://src.fedoraproject.org/fork/pviktori/rpms/python-pyside2/raw/5da9902bd8732b49eb722d71f306d4ab197c84b8/f/python3.11.patch
https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=52df3b8f64
https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=73adefe22f
https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=a09a1db839
From b64ad27d8dfeeecaaa8a98051252a32c9d998df4 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
Date: Thu, 9 Jun 2022 16:50:41 +0200
Subject: [PATCH] libshiboken: Fix a crash in Shiboken::Object::isValid() for
Python 3.11
The function is passed type objects for class methods, which caused
it to crash.
The first clause did not catch this, and so it was cast to SbkObject
below.
Add a type check to prevent this.
Pick-to: 6.3 6.2 5.15
Task-number: PYSIDE-1960
Change-Id: Icfdd6fefb7156ac5961444bd5395109849a1d66e
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -1468,6 +1468,7 @@ bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr)
bool isValid(PyObject *pyObj)
{
if (!pyObj || pyObj == Py_None
+ || PyType_Check(pyObj) != 0
|| Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) {
return true;
}
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -366,7 +366,7 @@ SbkObjectType *SbkObject_TypeF(void)
static PyTypeObject *type = nullptr;
if (!type) {
type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&SbkObject_Type_spec));
- Py_TYPE(type) = SbkObjectType_TypeF();
+ Py_SET_TYPE(type, SbkObjectType_TypeF());
Py_INCREF(Py_TYPE(type));
type->tp_weaklistoffset = offsetof(SbkObject, weakreflist);
type->tp_dictoffset = offsetof(SbkObject, ob_dict);
@@ -1110,7 +1110,7 @@ introduceWrapperType(PyObject *enclosingObject,
typeSpec->slots[0].pfunc = reinterpret_cast<void *>(baseType ? baseType : SbkObject_TypeF());
PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes);
- Py_TYPE(heaptype) = SbkObjectType_TypeF();
+ Py_SET_TYPE(heaptype, SbkObjectType_TypeF());
Py_INCREF(Py_TYPE(heaptype));
auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
#if PY_VERSION_HEX < 0x03000000
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -741,7 +741,7 @@ newTypeWithName(const char *name,
copyNumberMethods(numbers_fromFlag, newslots, &idx);
newspec.slots = newslots;
auto *type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&newspec));
- Py_TYPE(type) = SbkEnumType_TypeF();
+ Py_SET_TYPE(type, SbkEnumType_TypeF());
auto *enumType = reinterpret_cast<SbkEnumType *>(type);
PepType_SETP(enumType)->cppName = cppName;
From a09a1db8391243e6bb290ee66bb6e3afbb114c61 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
Date: Fri, 24 Jun 2022 09:22:01 +0200
Subject: libshiboken: Fix crashes with static strings in Python 3.11
In Python 3.11, some strings come with a refcount above decimal
1000000000, apparently indicating that they are interned. Replace the
mechanism by PyUnicode_InternFromString().
Task-number: PYSIDE-1960
Pick-to: 6.3 6.2 5.15
Change-Id: I6436afee351f89da5814b5d6bc76970b1b508168
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Upstream: https://code.qt.io/cgit/pyside/pyside-setup.git/commit/?id=a09a1db8391243e6bb290ee66bb6e3afbb114c61
--- a/libshiboken/sbkstring.cpp
+++ b/libshiboken/sbkstring.cpp
@@ -5,8 +5,14 @@
#include "sbkstaticstrings_p.h"
#include "autodecref.h"
-#include <vector>
-#include <unordered_set>
+#if PY_VERSION_HEX >= 0x030B0000 || defined(Py_LIMITED_API)
+# define USE_INTERN_STRINGS
+#endif
+
+#ifndef USE_INTERN_STRINGS
+# include <vector>
+# include <unordered_set>
+#endif
namespace Shiboken
{
@@ -179,6 +185,13 @@ Py_ssize_t len(PyObject *str)
// PyObject *attr = PyObject_GetAttr(obj, name());
//
+#ifdef USE_INTERN_STRINGS
+PyObject *createStaticString(const char *str)
+{
+ return PyUnicode_InternFromString(str);
+}
+#else
+
using StaticStrings = std::unordered_set<PyObject *>;
static void finalizeStaticStrings(); // forward
@@ -225,6 +238,8 @@ PyObject *createStaticString(const char *str)
return result;
}
+#endif // !USE_INTERN_STRINGS
+
///////////////////////////////////////////////////////////////////////
//
// PYSIDE-1019: Helper function for snake_case vs. camelCase names
cgit v1.2.1