From: DongHun Kwak Date: Wed, 25 Nov 2020 05:48:39 +0000 (+0900) Subject: Imported Upstream version 3.32.1 X-Git-Tag: upstream/3.32.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8cdb354b3844284bf24e4720b5f0f1352a24fb3;p=platform%2Fupstream%2Fpython-gobject.git Imported Upstream version 3.32.1 --- diff --git a/NEWS b/NEWS index e90e88e..ca71a7b 100644 --- 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 `) +* meson: tests: pass ``--quiet`` to g-ir-scanner :mr:`114` (:user:`Tim-Philipp Müller `) +* 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 `) + + 3.32.0 - 2019-03-10 ------------------- diff --git a/gi/pygi-array.c b/gi/pygi-array.c index 073e143..890e7c5 100644 --- a/gi/pygi-array.c +++ b/gi/pygi-array.c @@ -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 { diff --git a/gi/pygi-error.c b/gi/pygi-error.c index 8e4a793..b0eeccd 100644 --- a/gi/pygi-error.c +++ b/gi/pygi-error.c @@ -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 diff --git a/meson.build b/meson.build index a63d771..d27a005 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index 31f3aa3..5dd4cbc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/setup.py b/setup.py index ab18db8..f003b5b 100755 --- 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" diff --git a/tests/gimarshallingtestsextra.c b/tests/gimarshallingtestsextra.c index 4debaf5..d4d6189 100644 --- a/tests/gimarshallingtestsextra.c +++ b/tests/gimarshallingtestsextra.c @@ -2,18 +2,18 @@ * * Copyright (C) 2016 Thibault Saunier * - * 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 . + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . */ #include "gimarshallingtestsextra.h" diff --git a/tests/gimarshallingtestsextra.h b/tests/gimarshallingtestsextra.h index bc5f8fe..68ce1d1 100644 --- a/tests/gimarshallingtestsextra.h +++ b/tests/gimarshallingtestsextra.h @@ -2,18 +2,18 @@ * * Copyright (C) 2016 Thibault Saunier * - * 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 . + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . */ #ifndef EXTRA_TESTS diff --git a/tests/meson.build b/tests/meson.build index f72ead0..dbb74d1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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 = [