Imported Upstream version 3.32.1 upstream/3.32.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:48:39 +0000 (14:48 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:48:39 +0000 (14:48 +0900)
NEWS
gi/pygi-array.c
gi/pygi-error.c
meson.build
meson_options.txt
setup.py
tests/gimarshallingtestsextra.c
tests/gimarshallingtestsextra.h
tests/meson.build

diff --git a/NEWS b/NEWS
index e90e88e..ca71a7b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+3.32.1 - 2019-04-20
+-------------------
+
+* tests/gimarshallingtestsextra.c/h: relicense to LGPLv2.1+ :issue:`320`
+* meson: add ``tests`` option for disabling tests :mr:`113` (:user:`Adam Duskett <aduskett>`)
+* meson: tests: pass ``--quiet`` to g-ir-scanner :mr:`114` (:user:`Tim-Philipp Müller <tpm>`)
+* 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>`)
+
+
 3.32.0 - 2019-03-10
 -------------------
 
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 a63d771..d27a005 100644 (file)
@@ -1,5 +1,5 @@
 project('pygobject', 'c',
-  version : '3.32.0',
+  version : '3.32.1',
   meson_version : '>= 0.46.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized'])
@@ -174,4 +174,7 @@ configure_file(input : 'PKG-INFO.in',
 
 subdir('gi')
 subdir('pygtkcompat')
+with_tests = get_option('tests')
+if with_tests
 subdir('tests')
+endif
index 31f3aa3..5dd4cbc 100644 (file)
@@ -1,2 +1,3 @@
 option('python', type : 'string', value : 'python3')
 option('pycairo', type : 'boolean', value : true, description : 'build with pycairo integration')
+option('tests', type : 'boolean', value : true, description : 'build unit tests')
index ab18db8..f003b5b 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.32.0"
+PYGOBJECT_VERSION = "3.32.1"
 GLIB_VERSION_REQUIRED = "2.48.0"
 GI_VERSION_REQUIRED = "1.46.0"
 PYCAIRO_VERSION_REQUIRED = "1.11.1"
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 f72ead0..dbb74d1 100644 (file)
@@ -58,6 +58,7 @@ gnome.generate_gir(
   symbol_prefix : 'gi_marshalling_tests',
   includes : ['Gio-2.0'],
   build_by_default : true,
+  extra_args: ['--quiet'],
 )
 
 regress_sources += ['regressextra.c']
@@ -89,7 +90,7 @@ gnome.generate_gir(
   includes : ['Gio-2.0', 'cairo-1.0'],
   build_by_default : true,
   dependencies : regress_deps,
-  extra_args: regress_c_args,
+  extra_args: regress_c_args + ['--quiet'],
 )
 
 helper_sources = [