Imported Upstream version 3.33.1 upstream/3.33.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 24 Nov 2020 03:37:54 +0000 (12:37 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 24 Nov 2020 03:37:54 +0000 (12:37 +0900)
19 files changed:
.gitlab-ci.yml
.gitlab-ci/Dockerfile
.gitlab-ci/Dockerfile.gtk4
.gitlab-ci/run-docker-gtk4.sh
.gitlab-ci/run-docker-runtime.sh [new file with mode: 0755]
.gitlab-ci/run-docker.sh
.gitlab-ci/test-flatpak.sh
NEWS
docs/getting_started.rst
gi/gimodule.c
gi/overrides/GLib.py
gi/pygi-info.c
gi/pygobject-object.c
gi/pygobject.h
meson.build
setup.py
tests/regressextra.c
tests/regressextra.h
tests/test_signal.py

index 819d19b5347d30a62cdaf16a15fa135078d10293..be27ed22826e86d00c233bb3475d0969ded0ae23 100644 (file)
@@ -1,4 +1,4 @@
-image: registry.gitlab.gnome.org/gnome/pygobject/main:v10
+image: registry.gitlab.gnome.org/gnome/pygobject/main:v11
 
 stages:
   - build_and_test
@@ -81,12 +81,12 @@ python3-mingw64:
 
 python2.7:
   variables:
-    PYENV_VERSION: "2.7.15-debug"
+    PYENV_VERSION: "2.7.16-debug"
   <<: *defaults
 
 python3.5:
   variables:
-    PYENV_VERSION: "3.5.6"
+    PYENV_VERSION: "3.5.7"
   <<: *defaults
 
 python3.6:
@@ -96,25 +96,24 @@ python3.6:
 
 python3.7:
   variables:
-    PYENV_VERSION: "3.7.2-debug"
+    PYENV_VERSION: "3.7.3-debug"
   <<: *defaults
 
-pypy2.7:
-  allow_failure: true
+python3.8:
   variables:
-    PYENV_VERSION: "pypy2.7-7.0.0"
+    PYENV_VERSION: "3.8-dev-debug"
   <<: *defaults
 
-pypy3.5:
+pypy2.7:
   allow_failure: true
   variables:
-    PYENV_VERSION: "pypy3.5-7.0.0"
+    PYENV_VERSION: "pypy2.7-7.1.0"
   <<: *defaults
 
 pypy3.6:
   allow_failure: true
   variables:
-    PYENV_VERSION: "pypy3.6-7.0.0"
+    PYENV_VERSION: "pypy3.6-7.1.0"
   <<: *defaults
 
 xenial-i386-py2:
@@ -128,7 +127,7 @@ xenial-i386-py2:
 
 gtk4:
   stage: build_and_test
-  image: registry.gitlab.gnome.org/gnome/pygobject/gtk4:v3
+  image: registry.gitlab.gnome.org/gnome/pygobject/gtk4:v4
   artifacts:
     paths:
       - coverage/
index 547b096f62aceac91bfc0428e993b9a14b5c058c..eaaa484a5ec90e57c188c69fa5d3afeeda6e8641 100644 (file)
@@ -39,12 +39,12 @@ ENV PYTHON_CONFIGURE_OPTS="--enable-shared"
 
 RUN curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
 
-RUN pyenv install pypy2.7-7.0.0
-RUN pyenv install pypy3.5-7.0.0
-RUN pyenv install pypy3.6-7.0.0
-RUN pyenv install --debug 2.7.15
-RUN pyenv install 3.5.6
+RUN pyenv install pypy2.7-7.1.0
+RUN pyenv install pypy3.6-7.1.0
+RUN pyenv install --debug 2.7.16
+RUN pyenv install 3.5.7
 RUN pyenv install 3.6.8
-RUN pyenv install --debug 3.7.2
+RUN pyenv install --debug 3.7.3
+RUN pyenv install --debug 3.8-dev
 
 ENV PATH="/usr/lib/ccache:${PATH}"
index 95b9aff8b9ddac8863f066533e1ba4f3725be26c..a1e6034819eb5ca7ba5d73b336d8544a7cdbb3a4 100644 (file)
@@ -1,4 +1,4 @@
-FROM registry.gitlab.gnome.org/gnome/pygobject/main:v10
+FROM registry.gitlab.gnome.org/gnome/pygobject/main:v11
 
 USER root
 
@@ -25,4 +25,4 @@ RUN git clone https://gitlab.gnome.org/GNOME/gtk.git \
     && rm -Rf gtk
 
 USER user
-ENV PYENV_VERSION 3.7.2-debug
+ENV PYENV_VERSION 3.7.3-debug
index b333020b800d039209fe433a078cf0ba4012325c..e2de085810d8f7eb66887072168f076d663ab852 100755 (executable)
@@ -2,7 +2,7 @@
 
 set -e
 
-TAG="registry.gitlab.gnome.org/gnome/pygobject/gtk4:v3"
+TAG="registry.gitlab.gnome.org/gnome/pygobject/gtk4:v4"
 
 sudo docker build --tag "${TAG}" --file "Dockerfile.gtk4" .
 sudo docker run --rm --security-opt label=disable \
diff --git a/.gitlab-ci/run-docker-runtime.sh b/.gitlab-ci/run-docker-runtime.sh
new file mode 100755 (executable)
index 0000000..0205ec6
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+TAG="registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
+
+sudo docker pull "${TAG}"
+sudo docker run --privileged --rm --security-opt label=disable \
+    --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+    --tty --interactive "${TAG}" xvfb-run -a flatpak run --filesystem=host \
+    --share=network --socket=x11 --command=bash org.gnome.Sdk//master
index 667f304d33e391f4ba1e6f1f25973aeeb2482a62..c1d362b736b64e89e99246a7b2d7617c09404c4b 100755 (executable)
@@ -2,10 +2,10 @@
 
 set -e
 
-TAG="registry.gitlab.gnome.org/gnome/pygobject/main:v10"
+TAG="registry.gitlab.gnome.org/gnome/pygobject/main:v11"
 
 sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
     --file "Dockerfile" .
-sudo docker run -e PYENV_VERSION='3.7.2-debug' --rm --security-opt label=disable \
+sudo docker run -e PYENV_VERSION='3.7.3-debug' --rm --security-opt label=disable \
     --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
     --tty --interactive "${TAG}" bash
index 3ca5a7460730599c2ec14500cf2ec3e147135067..0dd01c466671c5887df12862d60d7b69dd79dbd7 100755 (executable)
@@ -2,5 +2,8 @@
 
 set -e
 
+python3 -m pip install --user pytest pytest-faulthandler
+# for some reason pip3 fails the first time now..
+# https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/776
 python3 -m pip install --user pytest pytest-faulthandler
 python3 setup.py test -s
diff --git a/NEWS b/NEWS
index 2db215cfade466994a3733ec08a323bed70b6dab..df89b7da85906c76cd93aba33c56c652f8a2eb9e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+3.33.1 - 2019-08-18
+-------------------
+
+* Make GLib.Variant.unpack a bit less costly :mr:`121` (:user:`Mathieu Bridon <mbridon>`)
+* pygobject: ignore GParameter deprecations :mr:`122` (:user:`Christian Hergert <chergert>`)
+* pygobject-object: fix refcount of floating return values :mr:`120` (:user:`Mathieu Duponchelle <mathieudu>`)
+* pygi-info: remove some dead code :issue:`303`
+
+
 3.32.2 - 2019-06-23
 -------------------
 
@@ -6,6 +15,15 @@
 * setup.py: specify python_requires
 
 
+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.32.1 - 2019-04-20
 -------------------
 
index 5e153f46d7dd82b7ec600c374e8f938869c63b11..c171b788a584ea9fdaa78a3bbb7dcbd6499e853b 100644 (file)
@@ -43,9 +43,9 @@ libraries.
 
 #) Go to http://www.msys2.org/ and download the x86_64 installer
 #) Follow the instructions on the page for setting up the basic environment
-#) Run ``C:\msys64\mingw32.exe`` - a terminal window should pop up
+#) Run ``C:\msys64\mingw64.exe`` - a terminal window should pop up
 #) Execute ``pacman -Suy``
-#) Execute ``pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python3-gobject``
+#) Execute ``pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject``
 #) To test that GTK 3 is working you can run ``gtk3-demo``
 #) Copy the ``hello.py`` script you created to ``C:\msys64\home\<username>``
 #) In the mingw32 terminal execute ``python3 hello.py`` - a window should appear.
index 2be5e478e814ad40377634eb0119381c1c08ef03..c9b29f5af73e1823cd5ef872cafa5d166a291c93 100644 (file)
@@ -2521,18 +2521,8 @@ PYGLIB_MODULE_START(_gi, "_gi")
     if (PyGIWarning == NULL)
         return PYGLIB_MODULE_ERROR_RETURN;
 
-    /* Use RuntimeWarning as the base class of PyGIDeprecationWarning
-     * for unstable (odd minor version) and use DeprecationWarning for
-     * stable (even minor version). This is so PyGObject deprecations
-     * behave the same as regular Python deprecations in stable releases.
-     */
-#if PYGOBJECT_MINOR_VERSION % 2
-    PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning",
-                                                PyExc_RuntimeWarning, NULL);
-#else
     PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning",
                                                 PyExc_DeprecationWarning, NULL);
-#endif
 
     /* Place holder object used to fill in "from Python" argument lists
      * for values not supplied by the caller but support a GI default.
index 186902e80cb765183aded229efadcd8803c5f536..78d309b651a7c58dddc98b3c72adb712b2ae762c 100644 (file)
@@ -153,6 +153,23 @@ class _VariantCreator(object):
         return builder.end()
 
 
+LEAF_ACCESSORS = {
+    'b': 'get_boolean',
+    'y': 'get_byte',
+    'n': 'get_int16',
+    'q': 'get_uint16',
+    'i': 'get_int32',
+    'u': 'get_uint32',
+    'x': 'get_int64',
+    't': 'get_uint64',
+    'h': 'get_handle',
+    'd': 'get_double',
+    's': 'get_string',
+    'o': 'get_string',  # object path
+    'g': 'get_string',  # signature
+}
+
+
 class Variant(GLib.Variant):
     def __new__(cls, format_string, value):
         """Create a GVariant from a native Python object.
@@ -220,35 +237,20 @@ class Variant(GLib.Variant):
     def unpack(self):
         """Decompose a GVariant into a native Python object."""
 
-        LEAF_ACCESSORS = {
-            'b': self.get_boolean,
-            'y': self.get_byte,
-            'n': self.get_int16,
-            'q': self.get_uint16,
-            'i': self.get_int32,
-            'u': self.get_uint32,
-            'x': self.get_int64,
-            't': self.get_uint64,
-            'h': self.get_handle,
-            'd': self.get_double,
-            's': self.get_string,
-            'o': self.get_string,  # object path
-            'g': self.get_string,  # signature
-        }
+        type_string = self.get_type_string()
 
         # simple values
-        la = LEAF_ACCESSORS.get(self.get_type_string())
+        la = LEAF_ACCESSORS.get(type_string)
         if la:
-            return la()
+            return getattr(self, la)()
 
         # tuple
-        if self.get_type_string().startswith('('):
-            res = [self.get_child_value(i).unpack()
-                   for i in range(self.n_children())]
-            return tuple(res)
+        if type_string.startswith('('):
+            return tuple(self.get_child_value(i).unpack()
+                         for i in range(self.n_children()))
 
         # dictionary
-        if self.get_type_string().startswith('a{'):
+        if type_string.startswith('a{'):
             res = {}
             for i in range(self.n_children()):
                 v = self.get_child_value(i)
@@ -256,21 +258,21 @@ class Variant(GLib.Variant):
             return res
 
         # array
-        if self.get_type_string().startswith('a'):
+        if type_string.startswith('a'):
             return [self.get_child_value(i).unpack()
                     for i in range(self.n_children())]
 
         # variant (just unbox transparently)
-        if self.get_type_string().startswith('v'):
+        if type_string.startswith('v'):
             return self.get_variant().unpack()
 
         # maybe
-        if self.get_type_string().startswith('m'):
+        if type_string.startswith('m'):
             if not self.n_children():
                 return None
             return self.get_child_value(0).unpack()
 
-        raise NotImplementedError('unsupported GVariant type ' + self.get_type_string())
+        raise NotImplementedError('unsupported GVariant type ' + type_string)
 
     @classmethod
     def split_signature(klass, signature):
index 5508001fba186c9d171f77c843e9a15a584fb715..94564ed7924005965c1727ac1b89b2056598adf6 100644 (file)
@@ -1824,7 +1824,6 @@ out:
 
 static gint
 _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
-                                           gboolean              is_instance,
                                            PyObject             *object)
 {
     gint retval;
@@ -1854,24 +1853,10 @@ _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info,
 
     g_assert (PyType_Check (py_type));
 
-    if (is_instance) {
-        retval = PyObject_IsInstance (object, py_type);
-        if (!retval) {
-            type_name_expected = _pygi_g_base_info_get_fullname (
-                                     (GIBaseInfo *) info);
-        }
-    } else {
-        if (!PyObject_Type (py_type)) {
-            type_name_expected = "type";
-            retval = 0;
-        } else if (!PyType_IsSubtype ( (PyTypeObject *) object,
-                                       (PyTypeObject *) py_type)) {
-            type_name_expected = _pygi_g_base_info_get_fullname (
-                                     (GIBaseInfo *) info);
-            retval = 0;
-        } else {
-            retval = 1;
-        }
+    retval = PyObject_IsInstance (object, py_type);
+    if (!retval) {
+        type_name_expected = _pygi_g_base_info_get_fullname (
+                                 (GIBaseInfo *) info);
     }
 
     Py_DECREF (py_type);
@@ -1920,7 +1905,7 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self,
     g_assert (container_info != NULL);
 
     /* Check the instance. */
-    if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) {
+    if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, instance)) {
         _PyGI_ERROR_PREFIX ("argument 1: ");
         return NULL;
     }
@@ -2028,7 +2013,7 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
     g_assert (container_info != NULL);
 
     /* Check the instance. */
-    if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) {
+    if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, instance)) {
         _PyGI_ERROR_PREFIX ("argument 1: ");
         return NULL;
     }
index 39c03ca3c65cac0f25c9ef10d5d17f8255d07321..bf9699530d1a95aeab5022b024bebe1c2364e68e 100644 (file)
@@ -1935,8 +1935,15 @@ pygobject_emit(PyGObject *self, PyObject *args)
     
     g_free(params);
     if ((query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE) != G_TYPE_NONE) {
+      gboolean was_floating = FALSE;
+
+      if (G_VALUE_HOLDS_OBJECT (&ret)) {
+        GObject *obj = g_value_get_object (&ret);
+        was_floating = g_object_is_floating (obj);
+      }
        py_ret = pyg_value_as_pyobject(&ret, TRUE);
-       g_value_unset(&ret);
+      if (!was_floating)
+             g_value_unset(&ret);
     } else {
        Py_INCREF(Py_None);
        py_ret = Py_None;
index d2425152945144b91d78b2ed983d62227b82e891..a45a4b0310b6de1ae63b6d08c299215cdb17a4ba 100644 (file)
@@ -154,12 +154,14 @@ struct _PyGObject_Functions {
     PyObject *(* paramspec_new)(GParamSpec *spec);
     GParamSpec *(*paramspec_get)(PyObject *tuple);
     int (*pyobj_to_unichar_conv)(PyObject *pyobj, void* ptr);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     gboolean (*parse_constructor_args)(GType        obj_type,
                                        char       **arg_names,
                                        char       **prop_names,
                                        GParameter  *params,
                                        guint       *nparams,
                                        PyObject   **py_args);
+G_GNUC_END_IGNORE_DEPRECATIONS
     PyObject *(* param_gvalue_as_pyobject) (const GValue* gvalue, 
                                             gboolean copy_boxed,
                                            const GParamSpec* pspec);
index 2064d254a29d66d42ff1cc2fae91de8c116ca395..30b540feee502ddb800698f4e0296e32ae57ae7c 100644 (file)
@@ -1,5 +1,5 @@
 project('pygobject', 'c',
-  version : '3.32.2',
+  version : '3.33.1',
   meson_version : '>= 0.46.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized'])
index 6f6f86dfab78e44a23917e297c33a7a6746d5938..802594ecd507072351c4039dba52e01410d0e7a1 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.2"
+PYGOBJECT_VERSION = "3.33.1"
 GLIB_VERSION_REQUIRED = "2.48.0"
 GI_VERSION_REQUIRED = "1.46.0"
 PYCAIRO_VERSION_REQUIRED = "1.11.1"
index d6af90bf1a17e711801e4c473fa19efdbbcb2967..7e53373a48922a1502218a8874070c14080d5a1f 100644 (file)
@@ -336,3 +336,43 @@ regress_test_cairo_matrix_out_caller_allocates (cairo_matrix_t *matrix)
 }
 
 #endif
+
+G_DEFINE_TYPE (RegressTestAction, regress_test_action, G_TYPE_INITIALLY_UNOWNED)
+
+enum
+{
+    SIGNAL_0,
+    ACTION_SIGNAL,
+    LAST_SIGNAL
+};
+
+static guint regress_test_action_signals[LAST_SIGNAL] = { 0 };
+
+static RegressTestAction *
+regress_test_action_do_action (RegressTestAction *self)
+{
+    RegressTestAction *ret = g_object_new (regress_test_action_get_type (), NULL);
+
+    return ret;
+}
+
+static void
+regress_test_action_init (RegressTestAction *self)
+{
+}
+
+static void regress_test_action_class_init (RegressTestActionClass *klass)
+{
+    /**
+     * RegressTestAction::action:
+     *
+     * An action signal.
+     *
+     * Returns: (transfer full): another #RegressTestAction
+     */
+    regress_test_action_signals[ACTION_SIGNAL] =
+        g_signal_new_class_handler ("action",
+        G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+        G_CALLBACK (regress_test_action_do_action), NULL, NULL,
+        NULL, regress_test_action_get_type (), 0);
+}
index 0b40ab0498557a418b815cd32cc4e5bcc0ac19e8..7fc30fe95e66dc738c3551ba16ac384b0c23af82 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef REGRESS_EXTRA_H
 #define REGRESS_EXTRA_H
 
+#include <glib-object.h>
+
 typedef struct _RegressTestBoxedC RegressTestBoxedC;
 typedef struct _RegressTestBoxedCWrapper RegressTestBoxedCWrapper;
 
@@ -62,4 +64,17 @@ void regress_test_cairo_matrix_out_caller_allocates (cairo_matrix_t *matrix);
 
 #endif
 
+/* RegressTestAction */
+
+typedef struct {
+  GInitiallyUnowned parent;
+} RegressTestAction;
+
+typedef struct {
+  GInitiallyUnownedClass parent_class;
+} RegressTestActionClass;
+
+_GI_TEST_EXTERN
+GType regress_test_action_get_type (void);
+
 #endif /* REGRESS_EXTRA_H */
index 16d95c27112b3290067cb18ea6ef605ba792cb4f..edc970fc718b5210b27d09bca95b6075b0bc9831 100644 (file)
@@ -1243,6 +1243,11 @@ class TestIntrospectedSignals(unittest.TestCase):
         # Boxed equality checks pointers by default.
         self.assertNotEqual(struct, held_struct)
 
+    def test_action(self):
+        obj = Regress.TestAction()
+        other_obj = obj.emit('action')
+        self.assertEqual(other_obj.__grefcount__, 1)
+
 
 class TestIntrospectedSignalsIssue158(unittest.TestCase):
     """