Hi Michael,

On Sat, May 09, 2020 at 08:32:24AM +0200, Michael Biebl wrote:
> This was broken by debian/patches/gcc10.patch
> 
> Bringing Andreas into the loop here.
> 

Thanks for notifying me and sorry for causing the breakage.

I'm not actually using nautilus-python myself which might be obvious by
now. Do you think you could test the attached patch instead?

(The use of static is basically a workaround because I'm to lazy. The
better fix would likely be to declare it extern in the header, which is
included twice, and then actually declare the variable in one of the
c source files.)

Maybe I'm still not really understanding the code though.... It's not
obvious to me what it's trying to do.

Regards,
Andreas Henriksson



--- nautilus-python-1.2.3.orig/src/nautilus-python-object.c
+++ nautilus-python-1.2.3/src/nautilus-python-object.c
@@ -40,7 +40,7 @@ int __PyString_Check(PyObject *obj) {
 #endif
 }
 
-char* __PyString_AsString(PyObject *obj) {
+const char* __PyString_AsString(PyObject *obj) {
 #if PY_MAJOR_VERSION >= 3
     return PyUnicode_AsUTF8(obj);
 #else
@@ -389,7 +389,7 @@ beach:
 #define METHOD_NAME "update_file_info"
 static NautilusOperationResult
 nautilus_python_object_update_file_info (NautilusInfoProvider         *provider,
-                                         NautilusFile                 *file,
+                                         NautilusFileInfo             *file_info,
                                          GClosure                     *update_complete,
                                          NautilusOperationHandle   **handle) {
     NautilusPythonObject *object = (NautilusPythonObject*)provider;
@@ -408,12 +408,12 @@ nautilus_python_object_update_file_info
                                      pygobject_new((GObject*)provider),
                                      py_handle,
                                      pyg_boxed_new(G_TYPE_CLOSURE, update_complete, TRUE, TRUE),
-                                     pygobject_new((GObject*)file));
+                                     pygobject_new((GObject*)file_info));
     }
     else if (PyObject_HasAttrString(object->instance, "update_file_info")) {
         py_ret = PyObject_CallMethod(object->instance,
                                      METHOD_PREFIX METHOD_NAME, "(N)",
-                                     pygobject_new((GObject*)file));
+                                     pygobject_new((GObject*)file_info));
     }
     else {
         goto beach;
@@ -434,7 +434,7 @@ nautilus_python_object_update_file_info
 #endif
 
 beach:
-    free_pygobject_data(file, NULL);
+    free_pygobject_data(file_info, NULL);
     Py_XDECREF(py_ret);
     pyg_gil_state_release(state);
     return ret;
--- nautilus-python-1.2.3.orig/src/nautilus-python.c
+++ nautilus-python-1.2.3/src/nautilus-python.c
@@ -22,6 +22,7 @@
 #endif
 
 #include <Python.h>
+#define NO_IMPORT_PYGOBJECT //To avoid a multiple definition, nautilus-python-object.c also includes and does the import.
 #include <pygobject.h>
 #include <gmodule.h>
 #include <gtk/gtk.h>
--- nautilus-python-1.2.3.orig/src/nautilus-python.h
+++ nautilus-python-1.2.3/src/nautilus-python.h
@@ -43,37 +43,37 @@ extern NautilusPythonDebug nautilus_pyth
 #define debug_enter_args(x, y) { if (nautilus_python_debug & NAUTILUS_PYTHON_DEBUG_MISC) \
                                      g_printf("%s: entered " x "\n", __FUNCTION__, y); }
 
-PyTypeObject *_PyGtkWidget_Type;
+static PyTypeObject *_PyGtkWidget_Type;
 #define PyGtkWidget_Type (*_PyGtkWidget_Type)
 
-PyTypeObject *_PyNautilusColumn_Type;
+static PyTypeObject *_PyNautilusColumn_Type;
 #define PyNautilusColumn_Type (*_PyNautilusColumn_Type)
 
-PyTypeObject *_PyNautilusColumnProvider_Type;
+static PyTypeObject *_PyNautilusColumnProvider_Type;
 #define PyNautilusColumnProvider_Type (*_PyNautilusColumnProvider_Type)
 
-PyTypeObject *_PyNautilusInfoProvider_Type;
+static PyTypeObject *_PyNautilusInfoProvider_Type;
 #define PyNautilusInfoProvider_Type (*_PyNautilusInfoProvider_Type)
 
-PyTypeObject *_PyNautilusLocationWidgetProvider_Type;
+static PyTypeObject *_PyNautilusLocationWidgetProvider_Type;
 #define PyNautilusLocationWidgetProvider_Type (*_PyNautilusLocationWidgetProvider_Type)
 
-PyTypeObject *_PyNautilusMenu_Type;
+static PyTypeObject *_PyNautilusMenu_Type;
 #define PyNautilusMenu_Type (*_PyNautilusMenu_Type)
 
-PyTypeObject *_PyNautilusMenuItem_Type;
+static PyTypeObject *_PyNautilusMenuItem_Type;
 #define PyNautilusMenuItem_Type (*_PyNautilusMenuItem_Type)
 
-PyTypeObject *_PyNautilusMenuProvider_Type;
+static PyTypeObject *_PyNautilusMenuProvider_Type;
 #define PyNautilusMenuProvider_Type (*_PyNautilusMenuProvider_Type)
 
-PyTypeObject *_PyNautilusPropertyPage_Type;
+static PyTypeObject *_PyNautilusPropertyPage_Type;
 #define PyNautilusPropertyPage_Type (*_PyNautilusPropertyPage_Type)
 
-PyTypeObject *_PyNautilusPropertyPageProvider_Type;
+static PyTypeObject *_PyNautilusPropertyPageProvider_Type;
 #define PyNautilusPropertyPageProvider_Type (*_PyNautilusPropertyPageProvider_Type)
 
-PyTypeObject *_PyNautilusOperationHandle_Type;
+static PyTypeObject *_PyNautilusOperationHandle_Type;
 #define PyNautilusOperationHandle_Type (*_PyNautilusOperationHandle_Type)
 
 #endif /* NAUTILUS_PYTHON_H */

Reply via email to