File py311.patch of Package python-wxPython.35301

Index: wxPython-4.1.1/sip/cpp/sip_corewxEvtHandler.cpp
===================================================================
--- wxPython-4.1.1.orig/sip/cpp/sip_corewxEvtHandler.cpp
+++ wxPython-4.1.1/sip/cpp/sip_corewxEvtHandler.cpp
@@ -68,7 +68,7 @@
                 // Call the event handler, passing the event object
                 tuple = PyTuple_New(1);
                 PyTuple_SET_ITEM(tuple, 0, arg);  // steals ref to arg
-                result = PyEval_CallObject(func, tuple);
+                result = PyObject_CallObject(func, tuple);
                 if ( result ) {
                     Py_DECREF(result);   // result is ignored, but we still need to decref it
                     PyErr_Clear();       // Just in case...
Index: wxPython-4.1.1/sip/siplib/siplib.c
===================================================================
--- wxPython-4.1.1.orig/sip/siplib/siplib.c
+++ wxPython-4.1.1/sip/siplib/siplib.c
@@ -13747,7 +13747,14 @@ static struct _frame *sip_api_get_frame(
 
     while (frame != NULL && depth > 0)
     {
+#if PY_VERSION_HEX < 0x03090000
         frame = frame->f_back;
+#else
+        frame = PyFrame_GetBack(frame);
+
+        /* Historically we return a borrowed reference. */
+        Py_XDECREF(frame);
+#endif
         --depth;
     }
 
Index: wxPython-4.1.1/wscript
===================================================================
--- wxPython-4.1.1.orig/wscript
+++ wxPython-4.1.1/wscript
@@ -11,6 +11,8 @@ import sys
 import os
 import setuptools
 
+import sysconfig
+
 try:
     from textwrap import indent
 except ImportError:
@@ -110,6 +112,9 @@ def configure(conf):
         conf.my_check_python_headers()
     else:
         conf.check_python_headers(features='pyext')
+        # python 3.11 compatibility
+        # SO is deprecated in 3.5 and removed in 3.11
+        conf.env['pyext_PATTERN'] = '%s' + sysconfig.get_config_var('EXT_SUFFIX')
 
     # fetch and save the debug options
     conf.env.debug = conf.options.debug
openSUSE Build Service is sponsored by