Imported Upstream version 3.30.5 upstream/3.30.5
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:48:00 +0000 (14:48 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:48:00 +0000 (14:48 +0900)
14 files changed:
.gitlab-ci.yml
.gitlab-ci/test-docker.sh
.gitlab-ci/test-msys2.sh
NEWS
examples/demo/demos/TreeView/treemodel_filelist.py
examples/demo/demos/TreeView/treemodel_filetree.py
gi/pygi-array.c
gi/pygi-error.c
gi/pygobject-object.c
meson.build
setup.py
tests/gimarshallingtestsextra.c
tests/gimarshallingtestsextra.h
tests/test_overrides_gtk.py

index 3a25c6a..64ba37a 100644 (file)
@@ -117,9 +117,8 @@ xenial-i386-py2:
   script:
    - bash -x ./.gitlab-ci/test-docker-old.sh
 
-gnome-master:
-  allow_failure: true
+gnome-runtime:
   stage: build_and_test
-  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
+  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.30
   script:
-    - xvfb-run -a flatpak run --filesystem=host --share=network --socket=x11 --command=bash org.gnome.Sdk//master -x .gitlab-ci/test-flatpak.sh
+    - xvfb-run -a flatpak run --filesystem=host --share=network --socket=x11 --command=bash org.gnome.Sdk//3.30 -x .gitlab-ci/test-flatpak.sh
index 141d654..4837d51 100755 (executable)
@@ -37,7 +37,7 @@ else
     meson _build -Dpython="$(which python)"
 fi
 ninja -C _build
-xvfb-run -a meson test -C _build -v
+xvfb-run -a meson test --timeout-multiplier 4 -C _build -v
 rm -Rf _build
 
 # CODE QUALITY
index 2b11aea..38d4fbc 100755 (executable)
@@ -51,10 +51,11 @@ export PYTHONDEVMODE=1
 $PYTHON setup.py build_tests
 MSYSTEM= $PYTHON -m coverage run tests/runtests.py
 
-curl -O -J -L "https://github.com/linux-test-project/lcov/archive/master.tar.gz"
-tar -xvzf lcov-master.tar.gz
-
-./lcov-master/bin/lcov \
-    --rc lcov_branch_coverage=1 --no-external \
-    --directory . --capture --output-file \
-    "${COV_DIR}/${COV_KEY}.lcov"
+# FIXME: lcov doesn't support gcc9
+#~ curl -O -J -L "https://github.com/linux-test-project/lcov/archive/master.tar.gz"
+#~ tar -xvzf lcov-master.tar.gz
+
+#~ ./lcov-master/bin/lcov \
+    #~ --rc lcov_branch_coverage=1 --no-external \
+    #~ --directory . --capture --output-file \
+    #~ "${COV_DIR}/${COV_KEY}.lcov"
diff --git a/NEWS b/NEWS
index 940085b..6235c56 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+3.30.5 - 2019-06-16
+-------------------
+
+* tests/gimarshallingtestsextra.c/h: relicense to LGPLv2.1+ :issue:`320`
+* Fix a crash when marshalling a GError to Python fails :mr:`115`
+* Fix leak of transfer-full/container C arrays :mr:`117` (:user:`Tomasz Miąsko <tmiasko>`)
+* Python 3.8b1 compatibility fixes
+
+
 3.30.4 - 2018-11-30
 -------------------
 
index f011a47..82e6d95 100644 (file)
@@ -125,16 +125,16 @@ class FileListModel(gtk.GenericTreeModel):
         except OSError:
             return None
         mode = filestat.st_mode
-        if column is 0:
+        if column == 0:
             if stat.S_ISDIR(mode):
                 return folderpb
             else:
                 return filepb
-        elif column is 1:
+        elif column == 1:
             return rowref
-        elif column is 2:
+        elif column == 2:
             return filestat.st_size
-        elif column is 3:
+        elif column == 3:
             return oct(stat.S_IMODE(mode))
         return time.ctime(filestat.st_mtime)
 
index 3b43190..eb8e2b9 100644 (file)
@@ -157,16 +157,16 @@ class FileTreeModel(gtk.GenericTreeModel):
         except OSError:
             return None
         mode = filestat.st_mode
-        if column is 0:
+        if column == 0:
             if stat.S_ISDIR(mode):
                 return folderpb
             else:
                 return filepb
-        elif column is 1:
+        elif column == 1:
             return os.path.basename(relpath)
-        elif column is 2:
+        elif column == 2:
             return filestat.st_size
-        elif column is 3:
+        elif column == 3:
             return oct(stat.S_IMODE(mode))
         return time.ctime(filestat.st_mtime)
 
index 073e143..890e7c5 100644 (file)
@@ -766,7 +766,7 @@ _pygi_marshal_cleanup_to_py_array (PyGIInvokeState *state,
             return;
 
         free_array = TRUE;
-        free_array_full = FALSE;
+        free_array_full = arg_cache->transfer != GI_TRANSFER_NOTHING;
     } else if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) {
         ptr_array_ = (GPtrArray *) data;
     } else {
index 8e4a793..b0eeccd 100644 (file)
@@ -36,8 +36,10 @@ PyObject *PyGError = NULL;
  *
  * Checks to see if @error has been set.  If @error has been set, then a
  * GLib.GError Python exception object is returned (but not raised).
+ * If not error is set returns Py_None.
  *
- * Returns: a GLib.GError Python exception object, or NULL.
+ * Returns: a GLib.GError Python exception object, or Py_None,
+ *     or NULL and sets an error if creating the exception object fails.
  */
 PyObject *
 pygi_error_marshal_to_py (GError **error)
@@ -50,7 +52,7 @@ pygi_error_marshal_to_py (GError **error)
     g_return_val_if_fail(error != NULL, NULL);
 
     if (*error == NULL)
-        return NULL;
+        Py_RETURN_NONE;
 
     state = PyGILState_Ensure();
 
@@ -93,8 +95,13 @@ pygi_error_check (GError **error)
     state = PyGILState_Ensure();
 
     exc_instance = pygi_error_marshal_to_py (error);
-    PyErr_SetObject(PyGError, exc_instance);
-    Py_DECREF(exc_instance);
+    if (exc_instance != NULL) {
+        PyErr_SetObject(PyGError, exc_instance);
+        Py_DECREF(exc_instance);
+    } else {
+        PyErr_Print ();
+        PyErr_SetString (PyExc_RuntimeError, "Converting the GError failed");
+    }
     g_clear_error(error);
 
     PyGILState_Release(state);
@@ -266,11 +273,7 @@ _pygi_marshal_to_py_gerror (PyGIInvokeState   *state,
         g_error_free (error);
     }
 
-    if (py_obj != NULL) {
-        return py_obj;
-    } else {
-        Py_RETURN_NONE;
-    }
+    return py_obj;
 }
 
 static gboolean
@@ -330,11 +333,7 @@ pygerror_from_gvalue (const GValue *value)
 {
     GError *gerror = (GError *) g_value_get_boxed (value);
     PyObject *pyerr = pygi_error_marshal_to_py (&gerror);
-    if (pyerr == NULL) {
-        Py_RETURN_NONE;
-    } else {
-        return pyerr;
-    }
+    return pyerr;
 }
 
 static int
index dbf46e1..39c03ca 100644 (file)
@@ -878,7 +878,10 @@ pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_
                                   offsetof(PyTypeObject, tp_iter),
                                   offsetof(PyTypeObject, tp_repr),
                                   offsetof(PyTypeObject, tp_str),
-                                  offsetof(PyTypeObject, tp_print) };
+#if PY_VERSION_HEX < 0x03000000
+                                  offsetof(PyTypeObject, tp_print),
+#endif
+    };
     gsize i;
 
     /* Happens when registering gobject.GObject itself, at least. */
index fab0768..1b30bc1 100644 (file)
@@ -1,5 +1,5 @@
 project('pygobject', 'c',
-  version : '3.30.4',
+  version : '3.30.5',
   meson_version : '>= 0.46.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized'])
@@ -72,7 +72,6 @@ else
     '-Wall',
     '-Warray-bounds',
     '-Wcast-align',
-    '-Wdeclaration-after-statement',
     '-Wduplicated-branches',
     '-Wextra',
     '-Wformat=2',
@@ -98,11 +97,18 @@ else
     '-Wsign-compare',
     '-Wstrict-aliasing',
     '-Wstrict-prototypes',
+    '-Wswitch-default',
     '-Wundef',
     '-Wunused-but-set-variable',
     '-Wwrite-strings',
   ]
 
+  if python.language_version().split('.')[0] == '2'
+    main_c_args += [
+        '-Wdeclaration-after-statement',
+    ]
+  endif
+
   main_c_args += [
     '-Wno-incompatible-pointer-types-discards-qualifiers',
     '-Wno-missing-field-initializers',
@@ -118,12 +124,6 @@ else
     '-fvisibility=hidden',
   ]
 
-  if not ['3.3', '3.4'].contains(python.language_version())
-    main_c_args += [
-      '-Wswitch-default',
-    ]
-  endif
-
   main_c_args = cc.get_supported_arguments(main_c_args)
 endif
 
index 52f8f78..fc46a4c 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ from distutils import dir_util, log
 from distutils.spawn import find_executable
 
 
-PYGOBJECT_VERSION = "3.30.4"
+PYGOBJECT_VERSION = "3.30.5"
 GLIB_VERSION_REQUIRED = "2.38.0"
 GI_VERSION_REQUIRED = "1.46.0"
 PYCAIRO_VERSION_REQUIRED = "1.11.1"
@@ -937,7 +937,6 @@ def add_ext_compiler_flags(ext, compiler, _cache={}):
                 "-Wall",
                 "-Warray-bounds",
                 "-Wcast-align",
-                "-Wdeclaration-after-statement",
                 "-Wduplicated-branches",
                 "-Wextra",
                 "-Wformat=2",
@@ -963,14 +962,15 @@ def add_ext_compiler_flags(ext, compiler, _cache={}):
                 "-Wsign-compare",
                 "-Wstrict-aliasing",
                 "-Wstrict-prototypes",
+                "-Wswitch-default",
                 "-Wundef",
                 "-Wunused-but-set-variable",
                 "-Wwrite-strings",
             ]
 
-            if sys.version_info[:2] != (3, 4):
+            if sys.version_info[0] == 2:
                 args += [
-                    "-Wswitch-default",
+                    "-Wdeclaration-after-statement",
                 ]
 
             args += [
index 4debaf5..d4d6189 100644 (file)
@@ -2,18 +2,18 @@
  *
  * Copyright (C) 2016 Thibault Saunier <tsaunier@gnome.org>
  *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "gimarshallingtestsextra.h"
index bc5f8fe..68ce1d1 100644 (file)
@@ -2,18 +2,18 @@
  *
  * Copyright (C) 2016 Thibault Saunier <tsaunier@gnome.org>
  *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef EXTRA_TESTS
index 643be5c..d83fa45 100644 (file)
@@ -6,10 +6,10 @@ from __future__ import absolute_import
 
 import contextlib
 import unittest
-import time
 import sys
 import gc
 import warnings
+import timeit
 
 from .helper import ignore_gi_deprecation_warnings, capture_glib_warnings
 
@@ -2069,12 +2069,12 @@ class TestTreeModel(unittest.TestCase):
         model = Gtk.ListStore(int, str)
 
         iterations = 2000
-        start = time.clock()
+        start = timeit.default_timer()
         i = iterations
         while i > 0:
             model.append([1, 'hello'])
             i -= 1
-        end = time.clock()
+        end = timeit.default_timer()
         sys.stderr.write('[%.0f µs/append] ' % ((end - start) * 1000000 / iterations))
 
     def test_filter_new_default(self):