gcc10.patch 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. From bd4820186751034c6b5acb9c71b1aeab03c56523 Mon Sep 17 00:00:00 2001
  2. From: Andreas Henriksson <andreas@fatal.se>
  3. Date: Mon, 11 May 2020 14:57:45 +0200
  4. Subject: [PATCH] Fix build with gcc 10
  5. Bug-Debian: https://bugs.debian.org/957578
  6. Forwarded: https://gitlab.gnome.org/GNOME/nautilus-python/-/merge_requests/7
  7. Last-Update: 2020-05-11
  8. ---
  9. src/nautilus-python-object.c | 10 +++++-----
  10. src/nautilus-python.c | 13 +++++++++++++
  11. src/nautilus-python.h | 22 +++++++++++-----------
  12. 3 files changed, 29 insertions(+), 16 deletions(-)
  13. diff --git a/src/nautilus-python-object.c b/src/nautilus-python-object.c
  14. index f343070..da185ad 100644
  15. --- a/src/nautilus-python-object.c
  16. +++ b/src/nautilus-python-object.c
  17. @@ -40,7 +40,7 @@ int __PyString_Check(PyObject *obj) {
  18. #endif
  19. }
  20. -char* __PyString_AsString(PyObject *obj) {
  21. +const char* __PyString_AsString(PyObject *obj) {
  22. #if PY_MAJOR_VERSION >= 3
  23. return PyUnicode_AsUTF8(obj);
  24. #else
  25. @@ -389,7 +389,7 @@ beach:
  26. #define METHOD_NAME "update_file_info"
  27. static NautilusOperationResult
  28. nautilus_python_object_update_file_info (NautilusInfoProvider *provider,
  29. - NautilusFile *file,
  30. + NautilusFileInfo *file_info,
  31. GClosure *update_complete,
  32. NautilusOperationHandle **handle) {
  33. NautilusPythonObject *object = (NautilusPythonObject*)provider;
  34. @@ -408,12 +408,12 @@ nautilus_python_object_update_file_info (NautilusInfoProvider *provider,
  35. pygobject_new((GObject*)provider),
  36. py_handle,
  37. pyg_boxed_new(G_TYPE_CLOSURE, update_complete, TRUE, TRUE),
  38. - pygobject_new((GObject*)file));
  39. + pygobject_new((GObject*)file_info));
  40. }
  41. else if (PyObject_HasAttrString(object->instance, "update_file_info")) {
  42. py_ret = PyObject_CallMethod(object->instance,
  43. METHOD_PREFIX METHOD_NAME, "(N)",
  44. - pygobject_new((GObject*)file));
  45. + pygobject_new((GObject*)file_info));
  46. }
  47. else {
  48. goto beach;
  49. @@ -434,7 +434,7 @@ nautilus_python_object_update_file_info (NautilusInfoProvider *provider,
  50. #endif
  51. beach:
  52. - free_pygobject_data(file, NULL);
  53. + free_pygobject_data(file_info, NULL);
  54. Py_XDECREF(py_ret);
  55. pyg_gil_state_release(state);
  56. return ret;
  57. diff --git a/src/nautilus-python.c b/src/nautilus-python.c
  58. index 843e3c6..510cdfb 100644
  59. --- a/src/nautilus-python.c
  60. +++ b/src/nautilus-python.c
  61. @@ -22,6 +22,7 @@
  62. #endif
  63. #include <Python.h>
  64. +#define NO_IMPORT_PYGOBJECT //To avoid a multiple definition, nautilus-python-object.c also includes and does the import.
  65. #include <pygobject.h>
  66. #include <gmodule.h>
  67. #include <gtk/gtk.h>
  68. @@ -42,6 +43,18 @@ static gboolean nautilus_python_init_python(void);
  69. static GArray *all_types = NULL;
  70. +PyTypeObject *_PyGtkWidget_Type;
  71. +PyTypeObject *_PyNautilusColumn_Type;
  72. +PyTypeObject *_PyNautilusColumnProvider_Type;
  73. +PyTypeObject *_PyNautilusInfoProvider_Type;
  74. +PyTypeObject *_PyNautilusLocationWidgetProvider_Type;
  75. +PyTypeObject *_PyNautilusMenu_Type;
  76. +PyTypeObject *_PyNautilusMenuItem_Type;
  77. +PyTypeObject *_PyNautilusMenuProvider_Type;
  78. +PyTypeObject *_PyNautilusPropertyPage_Type;
  79. +PyTypeObject *_PyNautilusPropertyPageProvider_Type;
  80. +PyTypeObject *_PyNautilusOperationHandle_Type;
  81. +
  82. static inline gboolean
  83. np_init_pygobject(void) {
  84. PyObject *gobject = pygobject_init (PYGOBJECT_MAJOR_VERSION, PYGOBJECT_MINOR_VERSION, PYGOBJECT_MICRO_VERSION);
  85. diff --git a/src/nautilus-python.h b/src/nautilus-python.h
  86. index 4c181f8..c940a06 100644
  87. --- a/src/nautilus-python.h
  88. +++ b/src/nautilus-python.h
  89. @@ -43,37 +43,37 @@ extern NautilusPythonDebug nautilus_python_debug;
  90. #define debug_enter_args(x, y) { if (nautilus_python_debug & NAUTILUS_PYTHON_DEBUG_MISC) \
  91. g_printf("%s: entered " x "\n", __FUNCTION__, y); }
  92. -PyTypeObject *_PyGtkWidget_Type;
  93. +extern PyTypeObject *_PyGtkWidget_Type;
  94. #define PyGtkWidget_Type (*_PyGtkWidget_Type)
  95. -PyTypeObject *_PyNautilusColumn_Type;
  96. +extern PyTypeObject *_PyNautilusColumn_Type;
  97. #define PyNautilusColumn_Type (*_PyNautilusColumn_Type)
  98. -PyTypeObject *_PyNautilusColumnProvider_Type;
  99. +extern PyTypeObject *_PyNautilusColumnProvider_Type;
  100. #define PyNautilusColumnProvider_Type (*_PyNautilusColumnProvider_Type)
  101. -PyTypeObject *_PyNautilusInfoProvider_Type;
  102. +extern PyTypeObject *_PyNautilusInfoProvider_Type;
  103. #define PyNautilusInfoProvider_Type (*_PyNautilusInfoProvider_Type)
  104. -PyTypeObject *_PyNautilusLocationWidgetProvider_Type;
  105. +extern PyTypeObject *_PyNautilusLocationWidgetProvider_Type;
  106. #define PyNautilusLocationWidgetProvider_Type (*_PyNautilusLocationWidgetProvider_Type)
  107. -PyTypeObject *_PyNautilusMenu_Type;
  108. +extern PyTypeObject *_PyNautilusMenu_Type;
  109. #define PyNautilusMenu_Type (*_PyNautilusMenu_Type)
  110. -PyTypeObject *_PyNautilusMenuItem_Type;
  111. +extern PyTypeObject *_PyNautilusMenuItem_Type;
  112. #define PyNautilusMenuItem_Type (*_PyNautilusMenuItem_Type)
  113. -PyTypeObject *_PyNautilusMenuProvider_Type;
  114. +extern PyTypeObject *_PyNautilusMenuProvider_Type;
  115. #define PyNautilusMenuProvider_Type (*_PyNautilusMenuProvider_Type)
  116. -PyTypeObject *_PyNautilusPropertyPage_Type;
  117. +extern PyTypeObject *_PyNautilusPropertyPage_Type;
  118. #define PyNautilusPropertyPage_Type (*_PyNautilusPropertyPage_Type)
  119. -PyTypeObject *_PyNautilusPropertyPageProvider_Type;
  120. +extern PyTypeObject *_PyNautilusPropertyPageProvider_Type;
  121. #define PyNautilusPropertyPageProvider_Type (*_PyNautilusPropertyPageProvider_Type)
  122. -PyTypeObject *_PyNautilusOperationHandle_Type;
  123. +extern PyTypeObject *_PyNautilusOperationHandle_Type;
  124. #define PyNautilusOperationHandle_Type (*_PyNautilusOperationHandle_Type)
  125. #endif /* NAUTILUS_PYTHON_H */
  126. --
  127. GitLab