diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:42:29 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:42:33 +0900 |
commit | c20b00fa62305380031ec383e1d7f7c548cdfe44 (patch) | |
tree | eff0bb0ed4ac1fc12518637304d67bf421a2783e | |
parent | 70d11d3c9704b35313f8b4dfbb3bc1c1c4afd87d (diff) | |
download | pygobject2-c20b00fa62305380031ec383e1d7f7c548cdfe44.tar.gz pygobject2-c20b00fa62305380031ec383e1d7f7c548cdfe44.tar.bz2 pygobject2-c20b00fa62305380031ec383e1d7f7c548cdfe44.zip |
Imported Upstream version 3.13.91
Change-Id: I0e28e5ad489cdaed2e72ffdfb2bdbb482de5dd0a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r-- | ChangeLog | 216 | ||||
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | PKG-INFO | 4 | ||||
-rw-r--r-- | aclocal.m4 | 2 | ||||
-rwxr-xr-x | configure | 85 | ||||
-rw-r--r-- | configure.ac | 32 | ||||
-rw-r--r-- | gi/docstring.py | 13 | ||||
-rw-r--r-- | gi/gimodule.c | 1 | ||||
-rw-r--r-- | gi/pygi-boxed.c | 5 | ||||
-rw-r--r-- | gi/pygi-closure.c | 10 | ||||
-rw-r--r-- | gi/pygi-list.c | 4 | ||||
-rw-r--r-- | gi/pygi-signal-closure.c | 41 | ||||
-rw-r--r-- | tests/test_docstring.py | 15 | ||||
-rw-r--r-- | tests/test_gi.py | 29 | ||||
-rw-r--r-- | tests/test_overrides_glib.py | 7 | ||||
-rw-r--r-- | tests/test_overrides_gtk.py | 24 | ||||
-rw-r--r-- | tests/test_signal.py | 2 | ||||
-rw-r--r-- | tests/test_subprocess.py | 17 |
18 files changed, 425 insertions, 97 deletions
@@ -1,3 +1,219 @@ +commit 8c6cf22d74075b7169512b9e7773a511abb9b759 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Sep 1 16:48:15 2014 -0700 + + docs: Skip "Constructors" header for anonymous structs + + Structs which don't have a size or constructor should not procuce + any doc + string. The trailing "::" was causing a problem with sphinx. + + gi/docstring.py | 8 ++++++-- + tests/test_docstring.py | 3 ++- + 2 files changed, 8 insertions(+), 3 deletions(-) + +commit c1ea60be30ebf11c2e5415180305e4ac3c573f57 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Sep 1 15:21:04 2014 -0700 + + docs: Fix error when using may_return_null() + + Fix error with an untested code path opened up by commit 1f78dc0ace. + + gi/docstring.py | 3 ++- + tests/test_docstring.py | 4 ++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +commit 1f78dc0ace5282def9f1f700bfe4523de07e7549 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Aug 29 16:49:14 2014 -0700 + + docs: Fix function doc string generator return types + + Change skip_return() access into a function call. This was causing + return type doc strings to always be skipped. + + gi/docstring.py | 2 +- + tests/test_docstring.py | 8 ++++++-- + 2 files changed, 7 insertions(+), 3 deletions(-) + +commit 28d0337f0e3d4b0e9c4350ce5d6cf0cb68da843f +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Aug 29 14:18:28 2014 -0700 + + Special case signal output arguments which are structs as + pass-by-reference + + Add a special case which avoids copying of struct arguments marked + as output + to signals. Since we don't currently support output arguments, + users have + come to rely on a pass-by-reference bug which was fixed and caused + this to + regress (bug 722899). Add unittest which is currently failing due + to a number + of issues with emit() not supporting type annotations or output + arguments + (bug 735693). + + https://bugzilla.gnome.org/show_bug.cgi?id=735486 + + gi/pygi-signal-closure.c | 41 + +++++++++++++++++++++++++++++++++++------ + tests/test_overrides_gtk.py | 24 ++++++++++++++++++++++++ + 2 files changed, 59 insertions(+), 6 deletions(-) + +commit 16f8f687eae0caa1e4059fd62bd1f9d4c7f655f7 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Wed Aug 27 23:55:06 2014 -0700 + + Ignore closure callbacks when Python is not initialized + + Add an immediate return in ffi closures if Python is not initialized. + This fixes rare events when which lead to a segfault when a process + is exiting. + + https://bugzilla.gnome.org/show_bug.cgi?id=722562 + + gi/pygi-closure.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +commit 27a14679dce33f64bbb5d77677eba83849f168ff +Author: Christoph Reiter <reiter.christoph@gmail.com> +Date: Fri Aug 22 21:51:31 2014 -0700 + + Change boxed init with args to warn instead of raise + + Replace raising a TypeError in gi.types.Boxed() with a warning. + Even though passing arguments or keywords to the parent class is + incorrect here, raising an exception was causing a bit of fallout + in some apps (Gramps). + + https://bugzilla.gnome.org/show_bug.cgi?id=727810 + + gi/pygi-boxed.c | 5 ++++- + tests/test_gi.py | 13 +++++++++++-- + 2 files changed, 15 insertions(+), 3 deletions(-) + +commit 6008748bd7ecc6e5c933e6902c77d8485b905a6f +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Aug 22 02:16:10 2014 -0700 + + tests: Add test for GLib.spawn_async_with_pipes() + + https://bugzilla.gnome.org/show_bug.cgi?id=735213 + + tests/test_signal.py | 2 +- + tests/test_subprocess.py | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 1 deletion(-) + +commit 983276fb1cbc261d062ef93ba2266d08a5a6f423 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Thu Aug 21 17:16:31 2014 -0700 + + Revert "Replace statically bound GLib.Variant.new_tuple() with GI" + + This was accidentally pushed. + Revert commit 35c6540c42a01e1155f44533cc09e6c9f94b6613. + + gi/gimodule.c | 39 +++++++++++++++++++++++++++++++++++++++ + gi/overrides/GLib.py | 12 +++++++----- + 2 files changed, 46 insertions(+), 5 deletions(-) + +commit b7a4e68a224ab66f67e45667023f74dd743e6177 +Author: Christoph Reiter <reiter.christoph@gmail.com> +Date: Fri Aug 22 01:04:40 2014 +0200 + + Fix crash in GList/GSList marshaling error handling path. + + In case PySequence_GetItem() failed, the retured NULL was passed + to PyDECREF. + + https://bugzilla.gnome.org/show_bug.cgi?id=735201 + + gi/pygi-list.c | 4 ++-- + tests/test_gi.py | 16 ++++++++++++++++ + 2 files changed, 18 insertions(+), 2 deletions(-) + +commit 35c6540c42a01e1155f44533cc09e6c9f94b6613 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Thu Aug 21 15:11:39 2014 -0700 + + Replace statically bound GLib.Variant.new_tuple() with GI + + Remove the static implementation of _wrap_pyg_variant_new_tuple with + usage of the dynamic version coming from GI. Array marshalling has + drastically improved in recent years making the dynamic version usable + with a small compatibility shim for the arguments. + + https://bugzilla.gnome.org/show_bug.cgi?id=735199 + + gi/gimodule.c | 39 --------------------------------------- + gi/overrides/GLib.py | 12 +++++------- + 2 files changed, 5 insertions(+), 46 deletions(-) + +commit c1d387540a0b2db66e860c574b070051a5431914 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Thu Aug 21 14:37:14 2014 -0700 + + Fix reference counting problems with GLib.Variant.new_tuple() + + Always sink the results of g_variant_new_tuple() in the statically + bound wrapper. This matches the generic GI marshalling behavior + of passing GVariants to Python with transfer-none. + + https://bugzilla.gnome.org/show_bug.cgi?id=735166 + + gi/gimodule.c | 1 + + tests/test_overrides_glib.py | 7 +++++++ + 2 files changed, 8 insertions(+) + +commit 9ce261f27742ba200f70003f162291a375d244d3 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Aug 19 14:57:31 2014 -0700 + + configure.ac: Fix darwin builds + + Merge platform_win32 and os_win32 variables/case statements and + define "link_python_libs" for win32 as well as darwin. + + https://bugzilla.gnome.org/show_bug.cgi?id=735068 + + configure.ac | 30 +++++++++++------------------- + 1 file changed, 11 insertions(+), 19 deletions(-) + +commit 92f0d6ebf9b67729d8253e15fce77b0ad0375573 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Wed Aug 20 13:39:31 2014 -0700 + + Skip marshalling NULL output arguments in Python closures + + Skip marshalling optional output arguments which are passed NULL + as the memory location. This fixes fallout from bug 727004. + + https://bugzilla.gnome.org/show_bug.cgi?id=735090 + + gi/pygi-closure.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit d7e30c3cacf3cdd550e4dbfe2fa47aea1ae28147 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Aug 18 19:10:36 2014 -0700 + + configure.ac: post release version bump to 3.13.91 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 17ba19c2e9b91a1bb8b03fabd4100d436c96975d +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Aug 18 19:07:10 2014 -0700 + + release 3.13.90 + + NEWS | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + commit 6bcfaf6e1e2331b704dd6067d45d6840e87632a2 Author: Simon Feltman <sfeltman@src.gnome.org> Date: Mon Aug 18 18:57:28 2014 -0700 @@ -1,3 +1,18 @@ +3.13.91 01-Sep-2014 + - docs: Fix return types in auto-generated doc strings (Simon Feltman) + - Special case signal output arguments which are structs as + pass-by-reference (Simon Feltman) (#735486) + - Ignore closure callbacks when Python is not initialized + (Simon Feltman) (#722562) + - Change boxed init with args to warn instead of raise + (Christoph Reiter) (#727810) + - Fix crash in GList/GSList marshaling error handling path. + (Christoph Reiter) (#735201) + - Fix reference counting problems with GLib.Variant.new_tuple() + (Simon Feltman) (#735166) + - Skip marshalling NULL output arguments in Python closures + (Simon Feltman) (#735090) + 3.13.90 18-Aug-2014 - Support array lengths on struct fields (Simon Feltman) (#688792) - Fast path Python property get access (Simon Feltman) (#723872) @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 3.13.90 +Version: 3.13.91 Summary: Python bindings for GObject Home-page: http://www.pygtk.org/ Author: James Henstridge @@ -8,7 +8,7 @@ Author-email: james@daa.com.au Maintainer: Simon Feltman Maintainer-email: sfeltman@src.gnome.org License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.13/pygobject-3.13.90.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.13/pygobject-3.13.91.tar.gz Description: Python bindings for GLib and GObject Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable @@ -672,7 +672,7 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[ case "$enable_compile_warnings" in no) - warning_flags= + warning_flags="-w" ;; minimum) warning_flags="-Wall" @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pygobject 3.13.90. +# Generated by GNU Autoconf 2.69 for pygobject 3.13.91. # # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.13.90' -PACKAGE_STRING='pygobject 3.13.90' +PACKAGE_VERSION='3.13.91' +PACKAGE_STRING='pygobject 3.13.91' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/' @@ -730,11 +730,9 @@ LIBTOOL OBJDUMP DLLTOOL AS +OS_EXT OS_WIN32_FALSE OS_WIN32_TRUE -OS_EXT -PLATFORM_WIN32_FALSE -PLATFORM_WIN32_TRUE host_os host_vendor host_cpu @@ -1396,7 +1394,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pygobject 3.13.90 to adapt to many kinds of systems. +\`configure' configures pygobject 3.13.91 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1466,7 +1464,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 3.13.90:";; + short | recursive ) echo "Configuration of pygobject 3.13.91:";; esac cat <<\_ACEOF @@ -1604,7 +1602,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 3.13.90 +pygobject configure 3.13.91 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1882,7 +1880,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pygobject $as_me 3.13.90, which was +It was created by pygobject $as_me 3.13.91, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2246,9 +2244,9 @@ $as_echo "#define PYGOBJECT_MINOR_VERSION 13" >>confdefs.h PYGOBJECT_MINOR_VERSION=13 -$as_echo "#define PYGOBJECT_MICRO_VERSION 90" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 91" >>confdefs.h -PYGOBJECT_MICRO_VERSION=90 +PYGOBJECT_MICRO_VERSION=91 ac_config_headers="$ac_config_headers config.h" @@ -2768,7 +2766,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='3.13.90' + VERSION='3.13.91' cat >>confdefs.h <<_ACEOF @@ -2893,29 +2891,33 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for some Win32 platform" >&5 -$as_echo_n "checking for some Win32 platform... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build time linking with Python (Darwin and Win32)" >&5 +$as_echo_n "checking for build time linking with Python (Darwin and Win32)... " >&6; } case "$host" in *-*-mingw*|*-*-cygwin*) - platform_win32=yes + os_win32=yes + link_python_libs=yes OS_EXT=dll ;; *-*-darwin*) + os_win32=no + link_python_libs=yes OS_EXT=dylib ;; *) - platform_win32=no + os_win32=no + link_python_libs=no OS_EXT=so ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 -$as_echo "$platform_win32" >&6; } - if test "$platform_win32" = "yes"; then - PLATFORM_WIN32_TRUE= - PLATFORM_WIN32_FALSE='#' +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $link_python_libs" >&5 +$as_echo "$link_python_libs" >&6; } + if test "$os_win32" = "yes"; then + OS_WIN32_TRUE= + OS_WIN32_FALSE='#' else - PLATFORM_WIN32_TRUE='#' - PLATFORM_WIN32_FALSE= + OS_WIN32_TRUE='#' + OS_WIN32_FALSE= fi @@ -2926,27 +2928,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 -$as_echo_n "checking for native Win32... " >&6; } -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $os_win32" >&5 -$as_echo "$os_win32" >&6; } - if test "$os_win32" = "yes"; then - OS_WIN32_TRUE= - OS_WIN32_FALSE='#' -else - OS_WIN32_TRUE='#' - OS_WIN32_FALSE= -fi - - case `pwd` in *\ * | *\ *) @@ -13081,7 +13062,7 @@ fi rm -f conftest.err conftest.i conftest.$ac_ext CPPFLAGS="$save_CPPFLAGS" -if test "x$os_win32" = "xyes"; then +if test "x$link_python_libs" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries required to embed python" >&5 $as_echo_n "checking for libraries required to embed python... " >&6; } @@ -13124,7 +13105,7 @@ if ac_fn_c_try_link "$LINENO"; then : $as_echo "yes" >&6; }; else LIBS="$save_LIBS"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; as_fn_error $? "Python libs not found. Windows requires Python modules to be explicitly linked to libpython." "$LINENO" 5 +$as_echo "no" >&6; }; as_fn_error $? "Python libs not found. Windows and Darwin require Python modules to be explicitly linked to libpython." "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -14332,7 +14313,7 @@ fi case "$enable_compile_warnings" in no) - warning_flags= + warning_flags="-w" ;; minimum) warning_flags="-Wall" @@ -14963,10 +14944,6 @@ else am__EXEEXT_FALSE= fi -if test -z "${PLATFORM_WIN32_TRUE}" && test -z "${PLATFORM_WIN32_FALSE}"; then - as_fn_error $? "conditional \"PLATFORM_WIN32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then as_fn_error $? "conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -15392,7 +15369,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pygobject $as_me 3.13.90, which was +This file was extended by pygobject $as_me 3.13.91, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15459,7 +15436,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pygobject config.status 3.13.90 +pygobject config.status 3.13.91 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 4e3e5b3..90413b9 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 3) m4_define(pygobject_minor_version, 13) -m4_define(pygobject_micro_version, 90) +m4_define(pygobject_micro_version, 91) m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) dnl versions of packages we require ... @@ -51,38 +51,30 @@ ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" AC_CANONICAL_BUILD AC_CANONICAL_HOST -AC_MSG_CHECKING([for some Win32 platform]) +AC_MSG_CHECKING([for build time linking with Python (Darwin and Win32)]) case "$host" in *-*-mingw*|*-*-cygwin*) - platform_win32=yes + os_win32=yes + link_python_libs=yes OS_EXT=dll ;; *-*-darwin*) + os_win32=no + link_python_libs=yes OS_EXT=dylib ;; *) - platform_win32=no + os_win32=no + link_python_libs=no OS_EXT=so ;; esac -AC_MSG_RESULT([$platform_win32]) -AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") +AC_MSG_RESULT([$link_python_libs]) +AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") AC_SUBST(OS_EXT) AC_DEFINE_UNQUOTED(OS_EXT, "$OS_EXT", [Define shared library extension]) -AC_MSG_CHECKING([for native Win32]) -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -AC_MSG_RESULT([$os_win32]) -AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") - LT_PREREQ([2.2.6]) LT_INIT([dlopen win32-dll disable-static]) @@ -126,8 +118,8 @@ PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfi AC_SUBST(PYTHON_SO) AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) -if test "x$os_win32" = "xyes"; then - AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.])) +if test "x$link_python_libs" = "xyes"; then + AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows and Darwin require Python modules to be explicitly linked to libpython.])) fi AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h]) diff --git a/gi/docstring.py b/gi/docstring.py index 80bb022..fec5f63 100644 --- a/gi/docstring.py +++ b/gi/docstring.py @@ -148,10 +148,11 @@ def _generate_callable_info_doc(info): # Build return + output argument strings out_args_strs = [] return_hint = _get_pytype_hint(info.get_return_type()) - if not info.skip_return and return_hint and return_hint not in hint_blacklist: + if not info.skip_return() and return_hint and return_hint not in hint_blacklist: + argstr = return_hint if info.may_return_null(): argstr += ' or None' - out_args_strs.append(return_hint) + out_args_strs.append(argstr) for i, arg in enumerate(args): if arg.get_direction() == Direction.IN: @@ -171,7 +172,8 @@ def _generate_callable_info_doc(info): def _generate_class_info_doc(info): - doc = '\n:Constructors:\n\n::\n\n' # start with \n to avoid auto indent of other lines + header = '\n:Constructors:\n\n::\n\n' # start with \n to avoid auto indent of other lines + doc = '' if isinstance(info, StructInfo): # Don't show default constructor for disguised (0 length) structs @@ -184,7 +186,10 @@ def _generate_class_info_doc(info): if method_info.is_constructor(): doc += ' ' + _generate_callable_info_doc(method_info) + '\n' - return doc + if doc: + return header + doc + else: + return '' def _generate_doc_dispatch(info): diff --git a/gi/gimodule.c b/gi/gimodule.c index 00c9422..a18c477 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -500,6 +500,7 @@ _wrap_pyg_variant_new_tuple (PyObject *self, PyObject *args) } variant = g_variant_new_tuple (values, PyTuple_Size (py_values)); + g_variant_ref_sink (variant); py_variant = _pygi_struct_new ( (PyTypeObject *) py_type, variant, FALSE); diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c index 557584b..a1494b6 100644 --- a/gi/pygi-boxed.c +++ b/gi/pygi-boxed.c @@ -134,7 +134,10 @@ _boxed_init (PyObject *self, static char *kwlist[] = { NULL }; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) { - return -1; + PyErr_Clear (); + PyErr_Warn (PyExc_TypeError, + "Passing arguments to gi.types.Boxed.__init__() is deprecated. " + "All arguments passed will be ignored."); } /* Don't call PyGBoxed's init, which raises an exception. */ diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index 15c6767..2a5a120 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -371,7 +371,8 @@ _pygi_closure_convert_arguments (PyGIInvokeState *state, for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) { PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i); - if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { + if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON && + state->arg_values[i].v_pointer) { state->arg_pointers[i].v_pointer = state->arg_values[i].v_pointer; state->arg_values[i] = *(GIArgument *) state->arg_values[i].v_pointer; } @@ -551,6 +552,13 @@ _pygi_closure_handle (ffi_cif *cif, gboolean success; PyGIInvokeState state = { 0, }; + /* Ignore closures when Python is not initialized. This can happen in cases + * where calling Python implemented vfuncs can happen at shutdown time. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=722562 */ + if (!Py_IsInitialized()) { + return; + } + /* Lock the GIL as we are coming into this code without the lock and we may be executing python code */ py_state = PyGILState_Ensure (); diff --git a/gi/pygi-list.c b/gi/pygi-list.c index f6589c1..e3f3c67 100644 --- a/gi/pygi-list.c +++ b/gi/pygi-list.c @@ -82,7 +82,7 @@ err: PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup; } */ - Py_DECREF (py_item); + Py_XDECREF (py_item); g_list_free (list_); _PyGI_ERROR_PREFIX ("Item %i: ", i); return FALSE; @@ -160,7 +160,7 @@ err: } */ - Py_DECREF (py_item); + Py_XDECREF (py_item); g_slist_free (list_); _PyGI_ERROR_PREFIX ("Item %i: ", i); return FALSE; diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c index 0c6b9b9..3cf8486 100644 --- a/gi/pygi-signal-closure.c +++ b/gi/pygi-signal-closure.c @@ -109,16 +109,19 @@ pygi_signal_closure_marshal(GClosure *closure, } else if (i < sig_info_highest_arg) { GIArgInfo arg_info; GITypeInfo type_info; + GITypeTag type_tag; GIArgument arg = { 0, }; PyObject *item = NULL; gboolean free_array = FALSE; + gboolean pass_struct_by_ref = FALSE; g_callable_info_load_arg(signal_info, i - 1, &arg_info); g_arg_info_load_type(&arg_info, &type_info); arg = _pygi_argument_from_g_value(¶m_values[i], &type_info); - - if (g_type_info_get_tag (&type_info) == GI_TYPE_TAG_ARRAY) { + + type_tag = g_type_info_get_tag (&type_info); + if (type_tag == GI_TYPE_TAG_ARRAY) { /* Skip the self argument of param_values */ arg.v_pointer = _pygi_argument_to_array (&arg, _pygi_argument_array_length_marshal, @@ -127,13 +130,39 @@ pygi_signal_closure_marshal(GClosure *closure, &type_info, &free_array); } - - item = _pygi_argument_to_object (&arg, &type_info, GI_TRANSFER_NOTHING); - + + /* Hack to ensure struct output args are passed-by-reference allowing + * callback implementors to modify the struct values. This is needed + * for keeping backwards compatibility and should be removed in future + * versions which support signal output arguments as return values. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=735486 + */ + if (type_tag == GI_TYPE_TAG_INTERFACE && + g_arg_info_get_direction (&arg_info) == GI_DIRECTION_OUT) { + GIBaseInfo *info = g_type_info_get_interface (&type_info); + GIInfoType info_type = g_base_info_get_type (info); + + if (info_type == GI_INFO_TYPE_STRUCT) { + GType gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo *) info); + if (g_type_is_a (gtype, G_TYPE_BOXED)) { + pass_struct_by_ref = TRUE; + } + } + + g_base_info_unref (info); + } + + if (pass_struct_by_ref) { + item = _pygi_argument_to_object (&arg, &type_info, GI_TRANSFER_EVERYTHING); + ((PyGBoxed *)item)->free_on_dealloc = FALSE; + + } else { + item = _pygi_argument_to_object (&arg, &type_info, GI_TRANSFER_NOTHING); + } + if (free_array) { g_array_free (arg.v_pointer, FALSE); } - if (item == NULL) { goto out; diff --git a/tests/test_docstring.py b/tests/test_docstring.py index 7573699..aa000b4 100644 --- a/tests/test_docstring.py +++ b/tests/test_docstring.py @@ -45,7 +45,7 @@ class Test(unittest.TestCase): 'flags:Gio.FileCopyFlags, ' \ 'cancellable:Gio.Cancellable=None, ' \ 'progress_callback:Gio.FileProgressCallback=None, ' \ - 'progress_callback_data=None)' + 'progress_callback_data=None) -> bool' self.assertEqual(Gio.File.copy.__doc__, g_file_copy_doc) @@ -57,7 +57,15 @@ class Test(unittest.TestCase): # This tests implicit array length args along with skipping a # boolean return self.assertEqual(GIMarshallingTests.init_function.__doc__, - 'init_function(argv:list=None) -> argv:list') + 'init_function(argv:list=None) -> bool, argv:list') + + def test_boolean_return(self): + self.assertEqual(GIMarshallingTests.boolean_return_true.__doc__, + 'boolean_return_true() -> bool') + + def test_may_return_none(self): + self.assertEqual(Gio.File.get_basename.__doc__, + 'get_basename(self) -> str or None') def test_class_doc_constructors(self): doc = GIMarshallingTests.Object.__doc__ @@ -70,8 +78,9 @@ class Test(unittest.TestCase): @unittest.skipUnless(has_cairo, 'built without cairo support') def test_private_struct_constructors(self): + # Structs without a size or constructor should have no constructor docs. doc = Regress.TestBoxedPrivate.__doc__ - self.assertTrue('TestBoxedPrivate()' not in doc) + self.assertEqual(doc, '') def test_array_inout_etc(self): self.assertEqual(GIMarshallingTests.array_inout_etc.__doc__, diff --git a/tests/test_gi.py b/tests/test_gi.py index d4ce662..20c7343 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -1117,6 +1117,14 @@ class TestGList(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, 42) self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, None) + def test_glist_int_none_in_error_getitem(self): + + class FailingSequence(Sequence): + def __getitem__(self, key): + raise Exception + + self.assertRaises(Exception, GIMarshallingTests.glist_int_none_in, FailingSequence((-1, 0, 1, 2))) + def test_glist_uint32_none_in(self): GIMarshallingTests.glist_uint32_none_in(Sequence((0, GObject.G_MAXUINT32))) @@ -1164,6 +1172,14 @@ class TestGSList(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, 42) self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, None) + def test_gslist_int_none_in_error_getitem(self): + + class FailingSequence(Sequence): + def __getitem__(self, key): + raise Exception + + self.assertRaises(Exception, GIMarshallingTests.gslist_int_none_in, FailingSequence((-1, 0, 1, 2))) + def test_gslist_utf8_none_in(self): GIMarshallingTests.gslist_utf8_none_in(Sequence(('0', '1', '2'))) @@ -1852,8 +1868,17 @@ class TestStructure(unittest.TestCase): self.assertEqual(struct.string_, 'hello') def test_union_init(self): - self.assertRaises(TypeError, GIMarshallingTests.Union, 42) - self.assertRaises(TypeError, GIMarshallingTests.Union, f=42) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GIMarshallingTests.Union(42) + + self.assertTrue(issubclass(warn[0].category, TypeError)) + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GIMarshallingTests.Union(f=42) + + self.assertTrue(issubclass(warn[0].category, TypeError)) def test_union(self): union = GIMarshallingTests.Union() diff --git a/tests/test_overrides_glib.py b/tests/test_overrides_glib.py index 4d7e63a..af68895 100644 --- a/tests/test_overrides_glib.py +++ b/tests/test_overrides_glib.py @@ -1,6 +1,7 @@ # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab +import gc import unittest import gi @@ -61,6 +62,12 @@ class TestGVariant(unittest.TestCase): self.assertEqual(variant.get_type_string(), '((si)(ub))') self.assertEqual(variant.unpack(), (('hello', -1), (_long(42), True))) + def test_new_tuple_sink(self): + # https://bugzilla.gnome.org/show_bug.cgi?id=735166 + variant = GLib.Variant.new_tuple(GLib.Variant.new_tuple()) + del variant + gc.collect() + def test_create_dictionary(self): variant = GLib.Variant('a{si}', {}) self.assertTrue(isinstance(variant, GLib.Variant)) diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py index ba90fc3..395b157 100644 --- a/tests/test_overrides_gtk.py +++ b/tests/test_overrides_gtk.py @@ -701,6 +701,30 @@ class TestSignals(unittest.TestCase): self.assertIsInstance(win._alloc_value, Gdk.Rectangle) self.assertTrue(win._alloc_error is None, win._alloc_error) + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=735693 + def test_overlay_child_position(self): + def get_child_position(overlay, widget, rect, user_data=None): + rect.x = 1 + rect.y = 2 + rect.width = 3 + rect.height = 4 + return True + + overlay = Gtk.Overlay() + overlay.connect('get-child-position', get_child_position) + + rect = Gdk.Rectangle() + rect.x = -1 + rect.y = -1 + rect.width = -1 + rect.height = -1 + + overlay.emit('get-child-position', None, rect) + self.assertEqual(rect.x, 1) + self.assertEqual(rect.y, 2) + self.assertEqual(rect.width, 3) + self.assertEqual(rect.height, 4) + @unittest.skipUnless(Gtk, 'Gtk not available') class TestBuilder(unittest.TestCase): diff --git a/tests/test_signal.py b/tests/test_signal.py index b4c9082..21d17c5 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -765,7 +765,7 @@ class TestSignalDecorator(unittest.TestCase): obj.emit('unnamed') self.assertEqual(self.unnamedCalled, True) - def NOtest_overridden_signal(self): + def test_overridden_signal(self): # Test that the pushed signal is called in with super and the override # which should both increment the "value" to 3 obj = self.DecoratedOverride() diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index 6da8ad2..720c950 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -120,6 +120,23 @@ class TestProcess(unittest.TestCase): self.assertEqual(out, b'hello world!\n') self.assertEqual(err, b'') + def test_spawn_async_with_pipes(self): + res, pid, stdin, stdout, stderr = GLib.spawn_async_with_pipes( + working_directory=None, + argv=['cat'], + envp=None, + flags=GLib.SpawnFlags.SEARCH_PATH) + + os.write(stdin, b'hello world!\n') + os.close(stdin) + out = os.read(stdout, 50) + os.close(stdout) + err = os.read(stderr, 50) + os.close(stderr) + GLib.spawn_close_pid(pid) + self.assertEqual(out, b'hello world!\n') + self.assertEqual(err, b'') + def test_spawn_async_envp(self): pid, stdin, stdout, stderr = GLib.spawn_async( ['sh', '-c', 'echo $TEST_VAR'], ['TEST_VAR=moo!'], |