Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37798535
en ru br
Репозитории ALT
S:5.2.0-alt1_13
5.1: 0.9.24.1-alt1
3.0: 0.8.10-alt1
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: libprelude

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: libprelude-5.2.0-fix-PyIOBase_Type.patch
Скачать


Description: Fix PyIOBase_Type
Author: Thomas Andrejak <thomas.andrejak@gmail.com>
Last-Update: 2021-08-13
--- libprelude-5.2.0/bindings/python/libpreludecpp-python.i	2020-09-09 16:30:32.510000000 +0200
+++ libprelude-5.2.0/bindings/python/libpreludecpp-python.i	2021-08-13 23:20:11.672221930 +0200
@@ -163,6 +163,26 @@
         $1 = _cb_python_log;
 };
 
+%{
+static PyObject *PyIOBase_TypeObj;
+
+static int init_file_emulator(void)
+{
+    PyObject *io = PyImport_ImportModule("_io");
+    if (io == NULL)
+        return -1;
+    PyIOBase_TypeObj = PyObject_GetAttrString(io, "_IOBase");
+    if (PyIOBase_TypeObj == NULL)
+        return -1;
+    return 0;
+}
+%}
+
+%init %{
+if (init_file_emulator() < 0) {
+    return NULL;
+}
+%}
 
 /* tell swig not to cast void * value */
 %typemap(in) void *nocast_file_p %{
@@ -172,8 +192,7 @@
 
         }
 #else
-        extern PyTypeObject PyIOBase_Type;
-        if ( ! PyObject_IsInstance((PyObject *) $input, (PyObject *) &PyIOBase_Type) ) {
+        if ( ! PyObject_IsInstance((PyObject *) $input, PyIOBase_TypeObj) ) {
                 SWIG_exception_fail(SWIG_RuntimeError, "Argument is not a file object");
         }
 #endif
@@ -186,8 +205,7 @@
 #if PY_VERSION_HEX < 0x03000000
         $1 = PyFile_Check((PyObject *) $input);
 #else
-        extern PyTypeObject PyIOBase_Type;
-        $1 = PyObject_IsInstance((PyObject *) $input, (PyObject *) &PyIOBase_Type);
+        $1 = PyObject_IsInstance((PyObject *) $input, PyIOBase_TypeObj);
 #endif
 %}
 
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin