summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:23 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:46:27 +0900
commit392945d666d2cfb31a844826a72b1eb65a52546f (patch)
treea21354051734cbace4e92d6b10c8fa8cd2721dda /gi
parent4723e0bb24cc41607e5af3bb7036855fa767df0b (diff)
downloadpygobject2-392945d666d2cfb31a844826a72b1eb65a52546f.tar.gz
pygobject2-392945d666d2cfb31a844826a72b1eb65a52546f.tar.bz2
pygobject2-392945d666d2cfb31a844826a72b1eb65a52546f.zip
Imported Upstream version 3.25.1
Change-Id: I31412b37aa390505e71295f3a2c2e3cf2ba88b41 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi')
-rw-r--r--gi/Makefile.am14
-rw-r--r--gi/Makefile.in69
-rw-r--r--gi/__init__.py9
-rw-r--r--gi/_constants.py52
-rw-r--r--gi/_gobject/Makefile.am19
-rw-r--r--gi/_gobject/Makefile.in595
-rw-r--r--gi/_gobject/__init__.py23
-rw-r--r--gi/_option.py14
-rw-r--r--gi/_propertyhelper.py47
-rw-r--r--gi/_signalhelper.py6
-rw-r--r--gi/gimodule.c87
-rw-r--r--gi/glibmodule.c56
-rw-r--r--gi/gobjectmodule.c157
-rw-r--r--gi/gobjectmodule.h21
-rw-r--r--gi/module.py6
-rw-r--r--gi/overrides/GLib.py13
-rw-r--r--gi/overrides/GObject.py82
-rw-r--r--gi/overrides/Gdk.py4
-rw-r--r--gi/overrides/Gio.py19
-rw-r--r--gi/overrides/Gtk.py7
-rw-r--r--gi/overrides/Makefile.in34
-rw-r--r--gi/overrides/__init__.py32
-rw-r--r--gi/pygboxed.c19
-rw-r--r--gi/pygenum.c10
-rw-r--r--gi/pygflags.c14
-rw-r--r--gi/pygi-argument.c4
-rw-r--r--gi/pygi-array.c20
-rw-r--r--gi/pygi-basictype.c186
-rw-r--r--gi/pygi-cache.c12
-rw-r--r--gi/pygi-closure.c9
-rw-r--r--gi/pygi-error.c8
-rw-r--r--gi/pygi-foreign-cairo.c53
-rw-r--r--gi/pygi-foreign.c2
-rw-r--r--gi/pygi-info.c13
-rw-r--r--gi/pygi-invoke.c11
-rw-r--r--gi/pygi-marshal-cleanup.c4
-rw-r--r--gi/pygi-object.c6
-rw-r--r--gi/pygi-property.c5
-rw-r--r--gi/pygi-signal-closure.c3
-rw-r--r--gi/pygi-signal-closure.h1
-rw-r--r--gi/pygi-source.c18
-rw-r--r--gi/pygi-struct-marshal.c3
-rw-r--r--gi/pygi-util.h1
-rw-r--r--gi/pygi-value.c24
-rw-r--r--gi/pygi-value.h2
-rw-r--r--gi/pyglib-python-compat.h8
-rw-r--r--gi/pyglib.c8
-rw-r--r--gi/pyglib.h8
-rw-r--r--gi/pygobject-object.c81
-rw-r--r--gi/pygobject.h19
-rw-r--r--gi/pygoptioncontext.c4
-rw-r--r--gi/pygoptiongroup.c13
-rw-r--r--gi/pygparamspec.c4
-rw-r--r--gi/pygpointer.c15
-rw-r--r--gi/pygspawn.c44
-rw-r--r--gi/pygtype.c18
-rw-r--r--gi/pygtype.h2
-rw-r--r--gi/repository/Makefile.in34
-rw-r--r--gi/types.py13
59 files changed, 837 insertions, 1228 deletions
diff --git a/gi/Makefile.am b/gi/Makefile.am
index 319f2ce..3841075 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -2,8 +2,7 @@ PLATFORM_VERSION = 3.0
SUBDIRS = \
repository \
- overrides \
- _gobject
+ overrides
extension_cppflags = \
$(PYTHON_INCLUDES) \
@@ -55,7 +54,6 @@ _gi_la_SOURCES = \
pygpointer.h \
pygtype.c \
pygtype.h \
- glibmodule.c \
pygoptioncontext.c \
pygoptioncontext.h \
pygoptiongroup.c \
@@ -121,17 +119,22 @@ _gi_la_SOURCES = \
pygi-hashtable.c \
pygi-hashtable.h
_gi_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS) \
+ $(WARN_CFLAGS) \
$(extension_cppflags) \
$(GLIB_CFLAGS) \
$(GI_CFLAGS)
_gi_la_CPPFLAGS = \
+ $(CODE_COVERAGE_CPPFLAGS) \
$(extension_cppflags)
_gi_la_LIBADD = \
+ $(CODE_COVERAGE_LIBS) \
$(extension_libadd) \
$(GLIB_LIBS) \
$(GI_LIBS) \
$(FFI_LIBS)
_gi_la_LDFLAGS = \
+ $(WARN_LDFLAGS) \
$(extension_ldflags) \
-export-symbols-regex "init_gi|PyInit__gi"
@@ -142,17 +145,22 @@ endif
_gi_cairo_la_SOURCES = \
pygi-foreign-cairo.c
_gi_cairo_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS) \
+ $(WARN_CFLAGS) \
$(GI_CFLAGS) \
$(CAIRO_CFLAGS) \
$(PYCAIRO_CFLAGS)
_gi_cairo_la_CPPFLAGS = \
+ $(CODE_COVERAGE_CPPFLAGS) \
$(extension_cppflags)
_gi_cairo_la_LIBADD = \
+ $(CODE_COVERAGE_LIBS) \
$(extension_libadd) \
$(GI_LIBS) \
$(CAIRO_LIBS) \
$(PYCAIRO_LIBS)
_gi_cairo_la_LDFLAGS = \
+ $(WARN_LDFLAGS) \
$(extension_ldflags) \
-export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
diff --git a/gi/Makefile.in b/gi/Makefile.in
index 328eaaa..6382c76 100644
--- a/gi/Makefile.in
+++ b/gi/Makefile.in
@@ -94,10 +94,22 @@ host_triplet = @host@
@ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la
subdir = gi
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
- $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+ $(top_srcdir)/m4/ax_append_flag.m4 \
+ $(top_srcdir)/m4/ax_append_link_flags.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_check_link_flag.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+ $(top_srcdir)/m4/ax_is_release.m4 \
+ $(top_srcdir)/m4/ax_require_defined.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -138,12 +150,13 @@ am__installdirs = "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(pygi_LTLIBRARIES)
am__DEPENDENCIES_1 =
@OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am__gi_la_OBJECTS = _gi_la-gobjectmodule.lo _gi_la-pygboxed.lo \
_gi_la-pygenum.lo _gi_la-pygflags.lo _gi_la-pyginterface.lo \
_gi_la-pygobject-object.lo _gi_la-pygparamspec.lo \
- _gi_la-pygpointer.lo _gi_la-pygtype.lo _gi_la-glibmodule.lo \
+ _gi_la-pygpointer.lo _gi_la-pygtype.lo \
_gi_la-pygoptioncontext.lo _gi_la-pygoptiongroup.lo \
_gi_la-pygspawn.lo _gi_la-pyglib.lo _gi_la-gimodule.lo \
_gi_la-pygi-repository.lo _gi_la-pygi-info.lo \
@@ -167,9 +180,9 @@ am__v_lt_1 =
_gi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_la_CFLAGS) $(CFLAGS) \
$(_gi_la_LDFLAGS) $(LDFLAGS) -o $@
-_gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+_gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am__gi_cairo_la_OBJECTS = _gi_cairo_la-pygi-foreign-cairo.lo
_gi_cairo_la_OBJECTS = $(am__gi_cairo_la_OBJECTS)
_gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -284,7 +297,6 @@ am__relativize = \
reldir="$$dir2"
pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
@@ -307,7 +319,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
@@ -340,8 +351,14 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
@@ -374,14 +391,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
PYCAIRO_LIBS = @PYCAIRO_LIBS@
PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
@@ -389,15 +404,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -458,8 +475,7 @@ top_srcdir = @top_srcdir@
PLATFORM_VERSION = 3.0
SUBDIRS = \
repository \
- overrides \
- _gobject
+ overrides
extension_cppflags = \
$(PYTHON_INCLUDES) \
@@ -498,7 +514,6 @@ _gi_la_SOURCES = \
pygpointer.h \
pygtype.c \
pygtype.h \
- glibmodule.c \
pygoptioncontext.c \
pygoptioncontext.h \
pygoptiongroup.c \
@@ -565,20 +580,25 @@ _gi_la_SOURCES = \
pygi-hashtable.h
_gi_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS) \
+ $(WARN_CFLAGS) \
$(extension_cppflags) \
$(GLIB_CFLAGS) \
$(GI_CFLAGS)
_gi_la_CPPFLAGS = \
+ $(CODE_COVERAGE_CPPFLAGS) \
$(extension_cppflags)
_gi_la_LIBADD = \
+ $(CODE_COVERAGE_LIBS) \
$(extension_libadd) \
$(GLIB_LIBS) \
$(GI_LIBS) \
$(FFI_LIBS)
_gi_la_LDFLAGS = \
+ $(WARN_LDFLAGS) \
$(extension_ldflags) \
-export-symbols-regex "init_gi|PyInit__gi"
@@ -586,20 +606,25 @@ _gi_cairo_la_SOURCES = \
pygi-foreign-cairo.c
_gi_cairo_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS) \
+ $(WARN_CFLAGS) \
$(GI_CFLAGS) \
$(CAIRO_CFLAGS) \
$(PYCAIRO_CFLAGS)
_gi_cairo_la_CPPFLAGS = \
+ $(CODE_COVERAGE_CPPFLAGS) \
$(extension_cppflags)
_gi_cairo_la_LIBADD = \
+ $(CODE_COVERAGE_LIBS) \
$(extension_libadd) \
$(GI_LIBS) \
$(CAIRO_LIBS) \
$(PYCAIRO_LIBS)
_gi_cairo_la_LDFLAGS = \
+ $(WARN_LDFLAGS) \
$(extension_ldflags) \
-export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
@@ -686,7 +711,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-gimodule.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-glibmodule.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-gobjectmodule.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygboxed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygenum.Plo@am__quote@
@@ -811,13 +835,6 @@ _gi_la-pygtype.lo: pygtype.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygtype.lo `test -f 'pygtype.c' || echo '$(srcdir)/'`pygtype.c
-_gi_la-glibmodule.lo: glibmodule.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-glibmodule.lo -MD -MP -MF $(DEPDIR)/_gi_la-glibmodule.Tpo -c -o _gi_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-glibmodule.Tpo $(DEPDIR)/_gi_la-glibmodule.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glibmodule.c' object='_gi_la-glibmodule.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c
-
_gi_la-pygoptioncontext.lo: pygoptioncontext.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygoptioncontext.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygoptioncontext.Tpo -c -o _gi_la-pygoptioncontext.lo `test -f 'pygoptioncontext.c' || echo '$(srcdir)/'`pygoptioncontext.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygoptioncontext.Tpo $(DEPDIR)/_gi_la-pygoptioncontext.Plo
diff --git a/gi/__init__.py b/gi/__init__.py
index 1b139c6..9fefc79 100644
--- a/gi/__init__.py
+++ b/gi/__init__.py
@@ -40,7 +40,6 @@ if 'gobject' in sys.modules:
from . import _gi
-from ._gi import _gobject
from ._gi import _API
from ._gi import Repository
from ._gi import PyGIDeprecationWarning
@@ -53,7 +52,13 @@ PyGIWarning = PyGIWarning
_versions = {}
_overridesdir = os.path.join(os.path.dirname(__file__), 'overrides')
-version_info = _gobject.pygobject_version[:]
+# Needed for compatibility with "pygobject.h"/pygobject_init()
+_gobject = types.ModuleType("gi._gobject")
+sys.modules[_gobject.__name__] = _gobject
+_gobject._PyGObject_API = _gi._PyGObject_API
+_gobject.pygobject_version = _gi.pygobject_version
+
+version_info = _gi.pygobject_version[:]
__version__ = "{0}.{1}.{2}".format(*version_info)
diff --git a/gi/_constants.py b/gi/_constants.py
index cec8d17..2153f90 100644
--- a/gi/_constants.py
+++ b/gi/_constants.py
@@ -17,31 +17,31 @@
# 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/>.
-from ._gi import _gobject
+from . import _gi
-TYPE_INVALID = _gobject.TYPE_INVALID
-TYPE_NONE = _gobject.type_from_name('void')
-TYPE_INTERFACE = _gobject.type_from_name('GInterface')
-TYPE_CHAR = _gobject.type_from_name('gchar')
-TYPE_UCHAR = _gobject.type_from_name('guchar')
-TYPE_BOOLEAN = _gobject.type_from_name('gboolean')
-TYPE_INT = _gobject.type_from_name('gint')
-TYPE_UINT = _gobject.type_from_name('guint')
-TYPE_LONG = _gobject.type_from_name('glong')
-TYPE_ULONG = _gobject.type_from_name('gulong')
-TYPE_INT64 = _gobject.type_from_name('gint64')
-TYPE_UINT64 = _gobject.type_from_name('guint64')
-TYPE_ENUM = _gobject.type_from_name('GEnum')
-TYPE_FLAGS = _gobject.type_from_name('GFlags')
-TYPE_FLOAT = _gobject.type_from_name('gfloat')
-TYPE_DOUBLE = _gobject.type_from_name('gdouble')
-TYPE_STRING = _gobject.type_from_name('gchararray')
-TYPE_POINTER = _gobject.type_from_name('gpointer')
-TYPE_BOXED = _gobject.type_from_name('GBoxed')
-TYPE_PARAM = _gobject.type_from_name('GParam')
-TYPE_OBJECT = _gobject.type_from_name('GObject')
-TYPE_PYOBJECT = _gobject.type_from_name('PyObject')
-TYPE_GTYPE = _gobject.type_from_name('GType')
-TYPE_STRV = _gobject.type_from_name('GStrv')
-TYPE_VARIANT = _gobject.type_from_name('GVariant')
+TYPE_INVALID = _gi.TYPE_INVALID
+TYPE_NONE = _gi.type_from_name('void')
+TYPE_INTERFACE = _gi.type_from_name('GInterface')
+TYPE_CHAR = _gi.type_from_name('gchar')
+TYPE_UCHAR = _gi.type_from_name('guchar')
+TYPE_BOOLEAN = _gi.type_from_name('gboolean')
+TYPE_INT = _gi.type_from_name('gint')
+TYPE_UINT = _gi.type_from_name('guint')
+TYPE_LONG = _gi.type_from_name('glong')
+TYPE_ULONG = _gi.type_from_name('gulong')
+TYPE_INT64 = _gi.type_from_name('gint64')
+TYPE_UINT64 = _gi.type_from_name('guint64')
+TYPE_ENUM = _gi.type_from_name('GEnum')
+TYPE_FLAGS = _gi.type_from_name('GFlags')
+TYPE_FLOAT = _gi.type_from_name('gfloat')
+TYPE_DOUBLE = _gi.type_from_name('gdouble')
+TYPE_STRING = _gi.type_from_name('gchararray')
+TYPE_POINTER = _gi.type_from_name('gpointer')
+TYPE_BOXED = _gi.type_from_name('GBoxed')
+TYPE_PARAM = _gi.type_from_name('GParam')
+TYPE_OBJECT = _gi.type_from_name('GObject')
+TYPE_PYOBJECT = _gi.type_from_name('PyObject')
+TYPE_GTYPE = _gi.type_from_name('GType')
+TYPE_STRV = _gi.type_from_name('GStrv')
+TYPE_VARIANT = _gi.type_from_name('GVariant')
TYPE_UNICHAR = TYPE_UINT
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
deleted file mode 100644
index 37068b8..0000000
--- a/gi/_gobject/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-AUTOMAKE_OPTIONS = 1.7
-PLATFORM_VERSION = 3.0
-
-pygobjectdir = $(pyexecdir)/gi/_gobject
-
-pygobject_PYTHON = \
- __init__.py
-
-# if we build in a separate tree, we need to symlink the *.py files from the
-# source tree; Python does not accept the extensions and modules in different
-# paths
-build_pylinks:
- for f in $(pygobject_PYTHON); do \
- [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
- done
-
-
-all: build_pylinks
-check-local: build_pylinks
diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in
deleted file mode 100644
index 3c41e5c..0000000
--- a/gi/_gobject/Makefile.in
+++ /dev/null
@@ -1,595 +0,0 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-VPATH = @srcdir@
-am__is_gnu_make = { \
- if test -z '$(MAKELEVEL)'; then \
- false; \
- elif test -n '$(MAKE_HOST)'; then \
- true; \
- elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
- true; \
- else \
- false; \
- fi; \
-}
-am__make_running_with_option = \
- case $${target_option-} in \
- ?) ;; \
- *) echo "am__make_running_with_option: internal error: invalid" \
- "target option '$${target_option-}' specified" >&2; \
- exit 1;; \
- esac; \
- has_opt=no; \
- sane_makeflags=$$MAKEFLAGS; \
- if $(am__is_gnu_make); then \
- sane_makeflags=$$MFLAGS; \
- else \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- bs=\\; \
- sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
- | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
- esac; \
- fi; \
- skip_next=no; \
- strip_trailopt () \
- { \
- flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
- }; \
- for flg in $$sane_makeflags; do \
- test $$skip_next = yes && { skip_next=no; continue; }; \
- case $$flg in \
- *=*|--*) continue;; \
- -*I) strip_trailopt 'I'; skip_next=yes;; \
- -*I?*) strip_trailopt 'I';; \
- -*O) strip_trailopt 'O'; skip_next=yes;; \
- -*O?*) strip_trailopt 'O';; \
- -*l) strip_trailopt 'l'; skip_next=yes;; \
- -*l?*) strip_trailopt 'l';; \
- -[dEDm]) skip_next=yes;; \
- -[JT]) skip_next=yes;; \
- esac; \
- case $$flg in \
- *$$target_option*) has_opt=yes; break;; \
- esac; \
- done; \
- test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = gi/_gobject
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
- $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(pygobject_PYTHON) \
- $(am__DIST_COMMON)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-am__v_GEN_1 =
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 =
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
-am__installdirs = "$(DESTDIR)$(pygobjectdir)"
-am__pep3147_tweak = \
- sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|'
-py_compile = $(top_srcdir)/py-compile
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CAIRO_CFLAGS = @CAIRO_CFLAGS@
-CAIRO_LIBS = @CAIRO_LIBS@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@
-CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
-CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
-CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
-CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
-CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FFI_CFLAGS = @FFI_CFLAGS@
-FFI_LIBS = @FFI_LIBS@
-FGREP = @FGREP@
-GCOV = @GCOV@
-GENHTML = @GENHTML@
-GIO_CFLAGS = @GIO_CFLAGS@
-GIO_LIBS = @GIO_LIBS@
-GI_CFLAGS = @GI_CFLAGS@
-GI_DATADIR = @GI_DATADIR@
-GI_LIBS = @GI_LIBS@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GOBJECT_QUERY = @GOBJECT_QUERY@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
-INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
-LCOV = @LCOV@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBFFI_PC = @LIBFFI_PC@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OS_EXT = @OS_EXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
-PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
-PYCAIRO_LIBS = @PYCAIRO_LIBS@
-PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
-PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
-PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
-PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_SO = @PYTHON_SO@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-runstatedir = @runstatedir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = 1.7
-PLATFORM_VERSION = 3.0
-pygobjectdir = $(pyexecdir)/gi/_gobject
-pygobject_PYTHON = \
- __init__.py
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/_gobject/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign gi/_gobject/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-install-pygobjectPYTHON: $(pygobject_PYTHON)
- @$(NORMAL_INSTALL)
- @list='$(pygobject_PYTHON)'; dlist=; list2=; test -n "$(pygobjectdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(pygobjectdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
- if test -f $$b$$p; then \
- $(am__strip_dir) \
- dlist="$$dlist $$f"; \
- list2="$$list2 $$b$$p"; \
- else :; fi; \
- done; \
- for file in $$list2; do echo $$file; done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygobjectdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(pygobjectdir)" || exit $$?; \
- done || exit $$?; \
- if test -n "$$dlist"; then \
- $(am__py_compile) --destdir "$(DESTDIR)" \
- --basedir "$(pygobjectdir)" $$dlist; \
- else :; fi
-
-uninstall-pygobjectPYTHON:
- @$(NORMAL_UNINSTALL)
- @list='$(pygobject_PYTHON)'; test -n "$(pygobjectdir)" || list=; \
- py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$py_files" || exit 0; \
- dir='$(DESTDIR)$(pygobjectdir)'; \
- pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \
- pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \
- py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
- echo "$$py_files_pep3147";\
- pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \
- pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \
- st=0; \
- for files in \
- "$$py_files" \
- "$$pyc_files" \
- "$$pyo_files" \
- "$$pyc_files_pep3147" \
- "$$pyo_files_pep3147" \
- ; do \
- $(am__uninstall_files_from_dir) || st=$$?; \
- done; \
- exit $$st
-tags TAGS:
-
-ctags CTAGS:
-
-cscope cscopelist:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile
-installdirs:
- for dir in "$(DESTDIR)$(pygobjectdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pygobjectPYTHON
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pygobjectPYTHON
-
-.MAKE: check-am install-am install-strip
-
-.PHONY: all all-am check check-am check-local clean clean-generic \
- clean-libtool cscopelist-am ctags-am distclean \
- distclean-generic distclean-libtool distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-pygobjectPYTHON install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
- uninstall-am uninstall-pygobjectPYTHON
-
-.PRECIOUS: Makefile
-
-
-# if we build in a separate tree, we need to symlink the *.py files from the
-# source tree; Python does not accept the extensions and modules in different
-# paths
-build_pylinks:
- for f in $(pygobject_PYTHON); do \
- [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
- done
-
-all: build_pylinks
-check-local: build_pylinks
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/gi/_gobject/__init__.py b/gi/_gobject/__init__.py
deleted file mode 100644
index 523a102..0000000
--- a/gi/_gobject/__init__.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- Mode: Python; py-indent-offset: 4 -*-
-# pygobject - Python bindings for the GObject library
-# Copyright (C) 2006-2012 Johan Dahlin
-#
-# gobject/__init__.py: initialisation file for gobject module
-#
-# 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 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 Lesser General Public
-# License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-# Needed for compatibility with "pygobject.h"
-import gi._gi
-_PyGObject_API = gi._gi._gobject._PyGObject_API
-pygobject_version = gi._gi._gobject.pygobject_version
diff --git a/gi/_option.py b/gi/_option.py
index eb711e1..45c74a3 100644
--- a/gi/_option.py
+++ b/gi/_option.py
@@ -40,7 +40,7 @@ else:
_basestring = basestring
_bytes = str
-from gi._gi import _glib
+from gi import _gi
from gi._error import GError
GLib = get_introspection_module('GLib')
@@ -209,8 +209,8 @@ class OptionGroup(optparse.OptionGroup):
gerror.message = str(error)
raise gerror
- group = _glib.OptionGroup(self.name, self.description,
- self.help_description, callback)
+ group = _gi.OptionGroup(self.name, self.description,
+ self.help_description, callback)
if self.translation_domain:
group.set_translation_domain(self.translation_domain)
@@ -285,12 +285,12 @@ class OptionParser(optparse.OptionParser):
parameter_string = self.usage + " - " + self.description
else:
parameter_string = self.usage
- context = _glib.OptionContext(parameter_string)
+ context = _gi.OptionContext(parameter_string)
context.set_help_enabled(self.help_enabled)
context.set_ignore_unknown_options(self.ignore_unknown_options)
for option_group in self.option_groups:
- if isinstance(option_group, _glib.OptionGroup):
+ if isinstance(option_group, _gi.OptionGroup):
g_group = option_group
else:
g_group = option_group.get_option_group(self)
@@ -303,7 +303,7 @@ class OptionParser(optparse.OptionParser):
opt = self._short_opt[option_name]
opt.process(option_name, option_value, values, self)
- main_group = _glib.OptionGroup(None, None, None, callback)
+ main_group = _gi.OptionGroup(None, None, None, callback)
main_entries = []
for option in self.option_list:
main_entries.extend(option._to_goptionentries())
@@ -323,7 +323,7 @@ class OptionParser(optparse.OptionParser):
args[0].parser = self
if args[0].parser is not self:
raise ValueError("invalid OptionGroup (wrong parser)")
- if isinstance(args[0], _glib.OptionGroup):
+ if isinstance(args[0], _gi.OptionGroup):
self.option_groups.append(args[0])
return
optparse.OptionParser.add_option_group(self, *args, **kwargs)
diff --git a/gi/_propertyhelper.py b/gi/_propertyhelper.py
index 810bdbc..e81de2e 100644
--- a/gi/_propertyhelper.py
+++ b/gi/_propertyhelper.py
@@ -20,8 +20,7 @@
import sys
import traceback
-import gi._gi
-_gobject = gi._gi._gobject
+from . import _gi
from ._constants import \
TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, \
@@ -31,14 +30,14 @@ from ._constants import \
TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \
TYPE_PYOBJECT, TYPE_GTYPE, TYPE_STRV, TYPE_VARIANT
-G_MAXFLOAT = _gobject.G_MAXFLOAT
-G_MAXDOUBLE = _gobject.G_MAXDOUBLE
-G_MININT = _gobject.G_MININT
-G_MAXINT = _gobject.G_MAXINT
-G_MAXUINT = _gobject.G_MAXUINT
-G_MINLONG = _gobject.G_MINLONG
-G_MAXLONG = _gobject.G_MAXLONG
-G_MAXULONG = _gobject.G_MAXULONG
+G_MAXFLOAT = _gi.G_MAXFLOAT
+G_MAXDOUBLE = _gi.G_MAXDOUBLE
+G_MININT = _gi.G_MININT
+G_MAXINT = _gi.G_MAXINT
+G_MAXUINT = _gi.G_MAXUINT
+G_MINLONG = _gi.G_MINLONG
+G_MAXLONG = _gi.G_MAXLONG
+G_MAXULONG = _gi.G_MAXULONG
if sys.version_info >= (3, 0):
_basestring = str
@@ -153,7 +152,7 @@ class Property(object):
return "<class 'GObject.Property'>"
def __init__(self, getter=None, setter=None, type=None, default=None,
- nick='', blurb='', flags=_gobject.PARAM_READWRITE,
+ nick='', blurb='', flags=_gi.PARAM_READWRITE,
minimum=None, maximum=None):
self.name = None
@@ -211,7 +210,7 @@ class Property(object):
def __repr__(self):
return '<GObject Property %s (%s)>' % (
self.name or '(uninitialized)',
- _gobject.type_name(self.type))
+ _gi.type_name(self.type))
def __get__(self, instance, klass):
if instance is None:
@@ -276,11 +275,11 @@ class Property(object):
if type_ in self._type_from_pytype_lookup:
return self._type_from_pytype_lookup[type_]
elif (isinstance(type_, type) and
- issubclass(type_, (_gobject.GObject,
- _gobject.GEnum,
- _gobject.GFlags,
- _gobject.GBoxed,
- _gobject.GInterface))):
+ issubclass(type_, (_gi.GObject,
+ _gi.GEnum,
+ _gi.GFlags,
+ _gi.GBoxed,
+ _gi.GInterface))):
return type_.__gtype__
elif type_ in (TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR,
TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG,
@@ -309,24 +308,24 @@ class Property(object):
elif ptype == TYPE_GTYPE:
if default is not None:
raise TypeError("GType types does not have default values")
- elif _gobject.type_is_a(ptype, TYPE_ENUM):
+ elif _gi.type_is_a(ptype, TYPE_ENUM):
if default is None:
raise TypeError("enum properties needs a default value")
- elif not _gobject.type_is_a(default, ptype):
+ elif not _gi.type_is_a(default, ptype):
raise TypeError("enum value %s must be an instance of %r" %
(default, ptype))
- elif _gobject.type_is_a(ptype, TYPE_FLAGS):
- if not _gobject.type_is_a(default, ptype):
+ elif _gi.type_is_a(ptype, TYPE_FLAGS):
+ if not _gi.type_is_a(default, ptype):
raise TypeError("flags value %s must be an instance of %r" %
(default, ptype))
- elif _gobject.type_is_a(ptype, TYPE_STRV) and default is not None:
+ elif _gi.type_is_a(ptype, TYPE_STRV) and default is not None:
if not isinstance(default, list):
raise TypeError("Strv value %s must be a list" % repr(default))
for val in default:
if type(val) not in (str, bytes):
raise TypeError("Strv value %s must contain only strings" % str(default))
- elif _gobject.type_is_a(ptype, TYPE_VARIANT) and default is not None:
- if not hasattr(default, '__gtype__') or not _gobject.type_is_a(default, TYPE_VARIANT):
+ elif _gi.type_is_a(ptype, TYPE_VARIANT) and default is not None:
+ if not hasattr(default, '__gtype__') or not _gi.type_is_a(default, TYPE_VARIANT):
raise TypeError("variant value %s must be an instance of %r" %
(default, ptype))
diff --git a/gi/_signalhelper.py b/gi/_signalhelper.py
index 30ff541..29d36ea 100644
--- a/gi/_signalhelper.py
+++ b/gi/_signalhelper.py
@@ -19,7 +19,7 @@
import sys
-from ._gi import _gobject
+from . import _gi
# Callable went away in python 3.0 and came back in 3.2.
# Use versioning to figure out when to define it, otherwise we have to deal with
@@ -127,7 +127,7 @@ class Signal(str):
name = name.__name__
return str.__new__(cls, name)
- def __init__(self, name='', func=None, flags=_gobject.SIGNAL_RUN_FIRST,
+ def __init__(self, name='', func=None, flags=_gi.SIGNAL_RUN_FIRST,
return_type=None, arg_types=None, doc='', accumulator=None, accu_data=None):
if func and not name:
name = func.__name__
@@ -164,7 +164,7 @@ class Signal(str):
# If obj is a GObject, than we call this signal as a closure otherwise
# it is used as a re-application of a decorator.
- if isinstance(obj, _gobject.GObject):
+ if isinstance(obj, _gi.GObject):
self.func(obj, *args, **kargs)
else:
# If self is already an allocated name, use it otherwise create a new named
diff --git a/gi/gimodule.c b/gi/gimodule.c
index d60a6a5..e14b4f6 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -21,8 +21,10 @@
* USA
*/
+#include <Python.h>
#include <glib-object.h>
+#include "config.h"
#include "pyglib.h"
#include "pyginterface.h"
#include "pygi-repository.h"
@@ -41,6 +43,13 @@
#include "pygi-boxed.h"
#include "pygi-info.h"
#include "pygi-struct.h"
+#include "pygobject-object.h"
+#include "pygoptioncontext.h"
+#include "pygoptiongroup.h"
+#include "pygspawn.h"
+#include "gobjectmodule.h"
+#include "pygparamspec.h"
+#include "pygpointer.h"
#include <pyglib-python-compat.h>
@@ -567,7 +576,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
iochannel = pyg_boxed_get (py_iochannel, GIOChannel);
while (status == G_IO_STATUS_NORMAL
- && (max_count == -1 || total_read < max_count)) {
+ && (max_count == -1 || total_read < (gsize)max_count)) {
gsize single_read;
char* buf;
gsize buf_size;
@@ -585,7 +594,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
if (ret_obj == NULL)
goto failure;
}
- else if (buf_size + total_read > PYGLIB_PyBytes_Size(ret_obj)) {
+ else if (buf_size + total_read > (gsize)PYGLIB_PyBytes_Size(ret_obj)) {
if (PYGLIB_PyBytes_Resize(&ret_obj, buf_size + total_read) == -1)
goto failure;
}
@@ -602,7 +611,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
total_read += single_read;
}
- if ( total_read != PYGLIB_PyBytes_Size(ret_obj) ) {
+ if ( total_read != (gsize)PYGLIB_PyBytes_Size(ret_obj) ) {
if (PYGLIB_PyBytes_Resize(&ret_obj, total_read) == -1)
goto failure;
}
@@ -627,6 +636,34 @@ static PyMethodDef _gi_functions[] = {
{ "source_set_callback", (PyCFunction) pyg_source_set_callback, METH_VARARGS },
{ "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS },
{ "require_foreign", (PyCFunction) pygi_require_foreign, METH_VARARGS | METH_KEYWORDS },
+ { "spawn_async",
+ (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
+ "spawn_async(argv, envp=None, working_directory=None,\n"
+ " flags=0, child_setup=None, user_data=None,\n"
+ " standard_input=None, standard_output=None,\n"
+ " standard_error=None) -> (pid, stdin, stdout, stderr)\n"
+ "\n"
+ "Execute a child program asynchronously within a glib.MainLoop()\n"
+ "See the reference manual for a complete reference.\n" },
+ { "type_name", pyg_type_name, METH_VARARGS },
+ { "type_from_name", pyg_type_from_name, METH_VARARGS },
+ { "type_is_a", pyg_type_is_a, METH_VARARGS },
+ { "type_register", _wrap_pyg_type_register, METH_VARARGS },
+ { "signal_new", pyg_signal_new, METH_VARARGS },
+ { "list_properties",
+ pyg_object_class_list_properties, METH_VARARGS },
+ { "new",
+ (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
+ { "signal_accumulator_true_handled",
+ (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
+ { "add_emission_hook",
+ (PyCFunction)pyg_add_emission_hook, METH_VARARGS },
+ { "_install_metaclass",
+ (PyCFunction)pyg__install_metaclass, METH_O },
+ { "_gvalue_get",
+ (PyCFunction)pyg__gvalue_get, METH_O },
+ { "_gvalue_set",
+ (PyCFunction)pyg__gvalue_set, METH_VARARGS },
{ NULL, NULL, 0 }
};
@@ -637,8 +674,7 @@ static struct PyGI_API CAPI = {
PYGLIB_MODULE_START(_gi, "_gi")
{
PyObject *api;
- PyObject *_glib_module;
- PyObject *_gobject_module;
+ PyObject *module_dict = PyModule_GetDict (module);
/* Always enable Python threads since we cannot predict which GI repositories
* might accept Python callbacks run within non-Python threads or might trigger
@@ -647,29 +683,6 @@ PYGLIB_MODULE_START(_gi, "_gi")
*/
PyEval_InitThreads ();
- _glib_module = pyglib__glib_module_create ();
- if (_glib_module == NULL) {
- return PYGLIB_MODULE_ERROR_RETURN;
- }
- /* In Python 2.x, pyglib_..._module_create returns a borrowed reference and
- * PyModule_AddObject steals a reference. Ensure we don't share a reference
- * between sys.modules and gi._gi._glib by incrementing the ref count here.
- * Note that we don't add this to the PYGLIB_MODULE_START macro because that
- * would cause a leak for the main module gi._gi */
- if (PY_MAJOR_VERSION < 3) {
- Py_INCREF (_glib_module);
- }
- PyModule_AddObject (module, "_glib", _glib_module);
- PyModule_AddStringConstant(module, "__package__", "gi._gi");
-
- _gobject_module = pyglib__gobject_module_create ();
- if (_gobject_module == NULL) {
- return PYGLIB_MODULE_ERROR_RETURN;
- }
- if (PY_MAJOR_VERSION < 3) {
- Py_INCREF (_gobject_module);
- }
- PyModule_AddObject (module, "_gobject", _gobject_module);
PyModule_AddStringConstant(module, "__package__", "gi._gi");
pygi_foreign_init ();
@@ -681,6 +694,24 @@ PYGLIB_MODULE_START(_gi, "_gi")
_pygi_ccallback_register_types (module);
pygi_resulttuple_register_types (module);
+ pyglib_spawn_register_types (module_dict);
+ pyglib_option_context_register_types (module_dict);
+ pyglib_option_group_register_types (module_dict);
+
+ pygobject_register_api (module_dict);
+ pygobject_register_constants (module);
+ pygobject_register_features (module_dict);
+ pygobject_register_version_tuples (module_dict);
+ pygobject_register_warnings (module_dict);
+ pygobject_type_register_types (module_dict);
+ pygobject_object_register_types (module_dict);
+ pygobject_interface_register_types (module_dict);
+ pygobject_paramspec_register_types (module_dict);
+ pygobject_boxed_register_types (module_dict);
+ pygobject_pointer_register_types (module_dict);
+ pygobject_enum_register_types (module_dict);
+ pygobject_flags_register_types (module_dict);
+
PyGIWarning = PyErr_NewException ("gi.PyGIWarning", PyExc_Warning, NULL);
/* Use RuntimeWarning as the base class of PyGIDeprecationWarning
diff --git a/gi/glibmodule.c b/gi/glibmodule.c
deleted file mode 100644
index 63b84c8..0000000
--- a/gi/glibmodule.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; c-set-style: python; c-basic-offset: 4 -*-
- * pyglib - Python bindings for GLib toolkit.
- * Copyright (C) 1998-2003 James Henstridge
- * 2004-2008 Johan Dahlin
- *
- * glibmodule.c: wrapper for the glib library.
- *
- * 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 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 Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Python.h>
-#include <glib.h>
-#include "pyglib.h"
-#include "pygoptioncontext.h"
-#include "pygoptiongroup.h"
-#include "pygspawn.h"
-
-/* ---------------- glib module functions -------------------- */
-
-static PyMethodDef _glib_functions[] = {
- { "spawn_async",
- (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
- "spawn_async(argv, envp=None, working_directory=None,\n"
- " flags=0, child_setup=None, user_data=None,\n"
- " standard_input=None, standard_output=None,\n"
- " standard_error=None) -> (pid, stdin, stdout, stderr)\n"
- "\n"
- "Execute a child program asynchronously within a glib.MainLoop()\n"
- "See the reference manual for a complete reference.\n" },
- { NULL, NULL, 0 }
-};
-
-PYGLIB_MODULE_START(_glib, "_glib")
-{
- PyObject *d = PyModule_GetDict(module);
-
- pyglib_spawn_register_types(d);
- pyglib_option_context_register_types(d);
- pyglib_option_group_register_types(d);
-}
-PYGLIB_MODULE_END
diff --git a/gi/gobjectmodule.c b/gi/gobjectmodule.c
index 0dc2670..ba1b9fc 100644
--- a/gi/gobjectmodule.c
+++ b/gi/gobjectmodule.c
@@ -60,11 +60,11 @@ static void
_pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func,
PyGThreadBlockFunc unblock_threads_func)
{
- PyGILState_STATE state = pyglib_gil_state_ensure ();
+ PyGILState_STATE state = PyGILState_Ensure ();
PyErr_Warn (PyExc_DeprecationWarning,
"Using pyg_set_thread_block_funcs is not longer needed. "
"PyGObject always uses Py_BLOCK/UNBLOCK_THREADS.");
- pyglib_gil_state_release (state);
+ PyGILState_Release (state);
}
/**
@@ -80,15 +80,15 @@ pyg_destroy_notify(gpointer user_data)
PyObject *obj = (PyObject *)user_data;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_DECREF(obj);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
/* ---------------- gobject module functions -------------------- */
-static PyObject *
+PyObject *
pyg_type_name (PyObject *self, PyObject *args)
{
PyObject *gtype;
@@ -113,7 +113,7 @@ pyg_type_name (PyObject *self, PyObject *args)
return NULL;
}
-static PyObject *
+PyObject *
pyg_type_from_name (PyObject *self, PyObject *args)
{
const gchar *name;
@@ -138,7 +138,7 @@ pyg_type_from_name (PyObject *self, PyObject *args)
return NULL;
}
-static PyObject *
+PyObject *
pyg_type_is_a (PyObject *self, PyObject *args)
{
PyObject *gtype, *gparent;
@@ -166,12 +166,12 @@ pyg_object_set_property (GObject *object, guint property_id,
PyObject *py_pspec, *py_value;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
object_wrapper = pygobject_new(object);
if (object_wrapper == NULL) {
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return;
}
@@ -190,7 +190,7 @@ pyg_object_set_property (GObject *object, guint property_id,
Py_DECREF(py_pspec);
Py_DECREF(py_value);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
static void
@@ -200,12 +200,12 @@ pyg_object_get_property (GObject *object, guint property_id,
PyObject *object_wrapper, *retval;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
object_wrapper = pygobject_new(object);
if (object_wrapper == NULL) {
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return;
}
@@ -216,7 +216,7 @@ pyg_object_get_property (GObject *object, guint property_id,
Py_DECREF(object_wrapper);
Py_XDECREF(retval);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
typedef struct _PyGSignalAccumulatorData {
@@ -236,7 +236,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
PyGSignalAccumulatorData *data = _data;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
if (ihint->detail)
py_detail = PYGLIB_PyUnicode_FromString(g_quark_to_string(ihint->detail));
else {
@@ -270,7 +270,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
}
Py_DECREF(py_retval);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return retval;
}
@@ -783,19 +783,19 @@ add_properties (GObjectClass *klass, PyObject *properties)
if (pspec) {
g_object_class_install_property(klass, 1, pspec);
} else {
- PyObject *type, *value, *traceback;
+ PyObject *type, *pvalue, *traceback;
ret = FALSE;
- PyErr_Fetch(&type, &value, &traceback);
- if (PYGLIB_PyUnicode_Check(value)) {
+ PyErr_Fetch(&type, &pvalue, &traceback);
+ if (PYGLIB_PyUnicode_Check(pvalue)) {
char msg[256];
g_snprintf(msg, 256,
"%s (while registering property '%s' for GType '%s')",
- PYGLIB_PyUnicode_AsString(value),
+ PYGLIB_PyUnicode_AsString(pvalue),
prop_name, G_OBJECT_CLASS_NAME(klass));
- Py_DECREF(value);
+ Py_DECREF(pvalue);
value = PYGLIB_PyUnicode_FromString(msg);
}
- PyErr_Restore(type, value, traceback);
+ PyErr_Restore(type, pvalue, traceback);
break;
}
}
@@ -892,7 +892,7 @@ pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass)
return 0;
}
-static PyObject *
+PyObject *
_wrap_pyg_type_register(PyObject *self, PyObject *args)
{
PyTypeObject *class;
@@ -986,9 +986,10 @@ pygobject_constructv(PyGObject *self,
g_assert (self->obj == NULL);
pygobject_init_wrapper_set((PyObject *) self);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
obj = g_object_newv(pyg_type_from_object((PyObject *) self),
n_parameters, parameters);
-
+G_GNUC_END_IGNORE_DEPRECATIONS
if (g_object_is_floating (obj))
self->private_flags.flags |= PYGOBJECT_GOBJECT_WAS_FLOATING;
pygobject_sink (obj);
@@ -1021,7 +1022,7 @@ pygobject__g_instance_init(GTypeInstance *instance,
* g_object_new -> we have no python wrapper, so create it
* now */
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
wrapper = pygobject_new_full(object,
/*steal=*/ FALSE,
g_class);
@@ -1037,7 +1038,7 @@ pygobject__g_instance_init(GTypeInstance *instance,
Py_DECREF(args);
Py_DECREF(kwargs);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
}
@@ -1214,7 +1215,7 @@ pyg_type_register(PyTypeObject *class, const char *type_name)
return 0;
}
-static PyObject *
+PyObject *
pyg_signal_new(PyObject *self, PyObject *args)
{
gchar *signal_name;
@@ -1281,7 +1282,7 @@ pyg_signal_new(PyObject *self, PyObject *args)
return NULL;
}
-static PyObject *
+PyObject *
pyg_object_class_list_properties (PyObject *self, PyObject *args)
{
GParamSpec **specs;
@@ -1338,7 +1339,7 @@ pyg_object_class_list_properties (PyObject *self, PyObject *args)
return list;
}
-static PyObject *
+PyObject *
pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *pytype;
@@ -1370,7 +1371,10 @@ pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
if (!pygobject_prepare_construct_properties (class, kwargs, &n_params, &params))
goto cleanup;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
obj = g_object_newv(type, n_params, params);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
if (!obj)
PyErr_SetString (PyExc_RuntimeError, "could not create object");
@@ -1395,13 +1399,13 @@ pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
static int
pygobject_gil_state_ensure (void)
{
- return pyglib_gil_state_ensure ();
+ return PyGILState_Ensure ();
}
static void
pygobject_gil_state_release (int flag)
{
- pyglib_gil_state_release(flag);
+ PyGILState_Release(flag);
}
/* Only for backwards compatibility */
@@ -1411,7 +1415,7 @@ pygobject_enable_threads(void)
return 0;
}
-static PyObject *
+PyObject *
pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args)
{
PyErr_SetString(PyExc_TypeError,
@@ -1433,7 +1437,7 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
PyObject *params;
guint i;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* construct Python tuple for the parameter values */
params = PyTuple_New(n_param_values);
@@ -1464,11 +1468,11 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
retval = (retobj == Py_True ? TRUE : FALSE);
Py_XDECREF(retobj);
out:
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return retval;
}
-static PyObject *
+PyObject *
pyg_add_emission_hook(PyGObject *self, PyObject *args)
{
PyObject *first, *callback, *extra_args, *data, *repr;
@@ -1526,7 +1530,7 @@ pyg_add_emission_hook(PyGObject *self, PyObject *args)
return PyLong_FromUnsignedLong(hook_id);
}
-static PyObject *
+PyObject *
pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass)
{
Py_INCREF(metaclass);
@@ -1539,7 +1543,7 @@ pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass)
return Py_None;
}
-static PyObject *
+PyObject *
pyg__gvalue_get(PyObject *module, PyObject *pygvalue)
{
if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) {
@@ -1551,13 +1555,13 @@ pyg__gvalue_get(PyObject *module, PyObject *pygvalue)
/*copy_boxed=*/ TRUE);
}
-static PyObject *
+PyObject *
pyg__gvalue_set(PyObject *module, PyObject *args)
{
PyObject *pygvalue;
PyObject *pyobject;
- if (!PyArg_ParseTuple (args, "OO:_gobject._gvalue_set",
+ if (!PyArg_ParseTuple (args, "OO:_gi._gvalue_set",
&pygvalue, &pyobject))
return NULL;
@@ -1573,30 +1577,6 @@ pyg__gvalue_set(PyObject *module, PyObject *args)
Py_RETURN_NONE;
}
-static PyMethodDef _gobject_functions[] = {
- { "type_name", pyg_type_name, METH_VARARGS },
- { "type_from_name", pyg_type_from_name, METH_VARARGS },
- { "type_is_a", pyg_type_is_a, METH_VARARGS },
- { "type_register", _wrap_pyg_type_register, METH_VARARGS },
- { "signal_new", pyg_signal_new, METH_VARARGS },
- { "list_properties",
- pyg_object_class_list_properties, METH_VARARGS },
- { "new",
- (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
- { "signal_accumulator_true_handled",
- (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
- { "add_emission_hook",
- (PyCFunction)pyg_add_emission_hook, METH_VARARGS },
- { "_install_metaclass",
- (PyCFunction)pyg__install_metaclass, METH_O },
- { "_gvalue_get",
- (PyCFunction)pyg__gvalue_get, METH_O },
- { "_gvalue_set",
- (PyCFunction)pyg__gvalue_set, METH_VARARGS },
-
- { NULL, NULL, 0 }
-};
-
/* ----------------- Constant extraction ------------------------ */
@@ -1616,7 +1596,7 @@ static PyMethodDef _gobject_functions[] = {
const gchar *
pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
{
- gint prefix_len;
+ size_t prefix_len;
guint i;
prefix_len = strlen(strip_prefix);
@@ -1632,9 +1612,9 @@ pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
/* strip off prefix from value name, while keeping it a valid
* identifier */
- for (i = prefix_len; i >= 0; i--) {
- if (g_ascii_isalpha(name[i]) || name[i] == '_') {
- return &name[i];
+ for (i = prefix_len + 1; i > 0; i--) {
+ if (g_ascii_isalpha(name[i - 1]) || name[i - 1] == '_') {
+ return &name[i - 1];
}
}
return name;
@@ -1757,7 +1737,7 @@ pyg_parse_constructor_args(GType obj_type,
params[param_i].name = prop_names[arg_i];
g_value_init(&params[param_i].value, spec->value_type);
if (pyg_value_from_pyobject(&params[param_i].value, py_args[arg_i]) == -1) {
- int i;
+ guint i;
PyErr_Format(PyExc_TypeError, "could not convert parameter '%s' of type '%s'",
arg_names[arg_i], g_type_name(spec->value_type));
g_type_class_unref(oclass);
@@ -1783,9 +1763,9 @@ _log_func(const gchar *log_domain,
PyGILState_STATE state;
PyObject* warning = user_data;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
PyErr_Warn(warning, (char *) message);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
} else
g_log_default_handler(log_domain, log_level, message, user_data);
}
@@ -1893,12 +1873,7 @@ struct _PyGObject_Functions pygobject_api_functions = {
pyg_flags_add,
pyg_flags_from_gtype,
- /* threads_enabled */
-#ifdef DISABLE_THREADING
- FALSE,
-#else
- TRUE,
-#endif
+ TRUE, /* threads_enabled */
pygobject_enable_threads,
pygobject_gil_state_ensure,
@@ -1925,7 +1900,7 @@ struct _PyGObject_Functions pygobject_api_functions = {
};
/* for addon libraries ... */
-static void
+void
pygobject_register_api(PyObject *d)
{
PyObject *api;
@@ -1936,7 +1911,7 @@ pygobject_register_api(PyObject *d)
}
/* some constants */
-static void
+void
pygobject_register_constants(PyObject *m)
{
/* PyFloat_ return a new ref, and add object takes the ref */
@@ -1968,7 +1943,7 @@ pygobject_register_constants(PyObject *m)
}
/* features */
-static void
+void
pygobject_register_features(PyObject *d)
{
PyObject *features;
@@ -1979,7 +1954,7 @@ pygobject_register_features(PyObject *d)
Py_DECREF(features);
}
-static void
+void
pygobject_register_version_tuples(PyObject *d)
{
PyObject *tuple;
@@ -1992,7 +1967,7 @@ pygobject_register_version_tuples(PyObject *d)
PyDict_SetItemString(d, "pygobject_version", tuple);
}
-static void
+void
pygobject_register_warnings(PyObject *d)
{
PyObject *warning;
@@ -2003,25 +1978,3 @@ pygobject_register_warnings(PyObject *d)
add_warning_redirection("GLib-GObject", warning);
add_warning_redirection("GThread", warning);
}
-
-
-PYGLIB_MODULE_START(_gobject, "_gobject")
-{
- PyObject *d;
-
- d = PyModule_GetDict(module);
- pygobject_register_api(d);
- pygobject_register_constants(module);
- pygobject_register_features(d);
- pygobject_register_version_tuples(d);
- pygobject_register_warnings(d);
- pygobject_type_register_types(d);
- pygobject_object_register_types(d);
- pygobject_interface_register_types(d);
- pygobject_paramspec_register_types(d);
- pygobject_boxed_register_types(d);
- pygobject_pointer_register_types(d);
- pygobject_enum_register_types(d);
- pygobject_flags_register_types(d);
-}
-PYGLIB_MODULE_END
diff --git a/gi/gobjectmodule.h b/gi/gobjectmodule.h
index 11f99cf..50bb6d1 100644
--- a/gi/gobjectmodule.h
+++ b/gi/gobjectmodule.h
@@ -8,4 +8,25 @@ int pygobject_constructv (PyGObject *self,
guint n_parameters,
GParameter *parameters);
+void pygobject_register_api (PyObject *d);
+void pygobject_register_constants (PyObject *m);
+void pygobject_register_features (PyObject *d);
+void pygobject_register_version_tuples (PyObject *d);
+void pygobject_register_warnings (PyObject *d);
+
+PyObject * pyg_type_name (PyObject *self, PyObject *args);
+PyObject * pyg_type_from_name (PyObject *self, PyObject *args);
+PyObject * pyg_type_is_a (PyObject *self, PyObject *args);
+PyObject * _wrap_pyg_type_register (PyObject *self, PyObject *args);
+PyObject * pyg_signal_new (PyObject *self, PyObject *args);
+PyObject * pyg_object_class_list_properties (PyObject *self, PyObject *args);
+PyObject * pyg_object_new (PyGObject *self, PyObject *args,
+ PyObject *kwargs);
+PyObject * pyg_signal_accumulator_true_handled (PyObject *unused, PyObject *args);
+PyObject * pyg_add_emission_hook (PyGObject *self, PyObject *args);
+PyObject * pyg__install_metaclass (PyObject *dummy,
+ PyTypeObject *metaclass);
+PyObject * pyg__gvalue_get (PyObject *module, PyObject *pygvalue);
+PyObject * pyg__gvalue_set (PyObject *module, PyObject *args);
+
#endif /*_PYGOBJECT_GOBJECTMODULE_H_*/
diff --git a/gi/module.py b/gi/module.py
index fd8f508..0b22634 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -53,13 +53,11 @@ from ._gi import \
enum_register_new_gtype_and_add, \
flags_add, \
flags_register_new_gtype_and_add, \
- _gobject
+ GInterface
from .types import \
GObjectMeta, \
StructMeta
-GInterface = _gobject.GInterface
-
from ._constants import \
TYPE_NONE, \
TYPE_BOXED, \
@@ -82,7 +80,7 @@ def get_parent_for_object(object_info):
# for an existing wrapper on the GType and use it as a base for the
# new introspection wrapper. This allows static C wrappers already
# registered with the GType to be used as the introspection base
- # (_gobject.GObject for example)
+ # (_gi.GObject for example)
gtype = object_info.get_g_type()
if gtype and gtype.pytype:
return gtype.pytype
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index ab0e83a..372d6d4 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -40,15 +40,14 @@ __all__.append('option')
# Types and functions still needed from static bindings
-from gi._gi import _glib
-from gi._gi import _gobject
+from gi import _gi
from gi._error import GError
Error = GError
-OptionContext = _glib.OptionContext
-OptionGroup = _glib.OptionGroup
-Pid = _glib.Pid
-spawn_async = _glib.spawn_async
+OptionContext = _gi.OptionContext
+OptionGroup = _gi.OptionGroup
+Pid = _gi.Pid
+spawn_async = _gi.spawn_async
def threads_init():
@@ -552,7 +551,7 @@ for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE',
'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE',
'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']:
attr = name.split("_", 1)[-1]
- globals()[attr] = getattr(_gobject, name)
+ globals()[attr] = getattr(_gi, name)
__all__.append(attr)
diff --git a/gi/overrides/GObject.py b/gi/overrides/GObject.py
index 2e8f755..c252bfa 100644
--- a/gi/overrides/GObject.py
+++ b/gi/overrides/GObject.py
@@ -33,8 +33,8 @@ from gi import PyGIDeprecationWarning
from gi import _propertyhelper as propertyhelper
from gi import _signalhelper as signalhelper
+from gi import _gi
-_gobject = gi._gi._gobject
GObjectModule = gi.module.get_introspection_module('GObject')
@@ -42,7 +42,7 @@ __all__ = []
from gi import _option as option
-sys.modules['gi._gobject.option'] = option
+option = option
# API aliases for backwards compatibility
@@ -184,27 +184,27 @@ for name in ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS',
__all__.append(name)
# Static types
-GBoxed = _gobject.GBoxed
-GEnum = _gobject.GEnum
-GFlags = _gobject.GFlags
-GInterface = _gobject.GInterface
-GObject = _gobject.GObject
-GObjectWeakRef = _gobject.GObjectWeakRef
-GParamSpec = _gobject.GParamSpec
-GPointer = _gobject.GPointer
-GType = _gobject.GType
-Warning = _gobject.Warning
+GBoxed = _gi.GBoxed
+GEnum = _gi.GEnum
+GFlags = _gi.GFlags
+GInterface = _gi.GInterface
+GObject = _gi.GObject
+GObjectWeakRef = _gi.GObjectWeakRef
+GParamSpec = _gi.GParamSpec
+GPointer = _gi.GPointer
+GType = _gi.GType
+Warning = _gi.Warning
__all__ += ['GBoxed', 'GEnum', 'GFlags', 'GInterface', 'GObject',
'GObjectWeakRef', 'GParamSpec', 'GPointer', 'GType',
'Warning']
-features = _gobject.features
-list_properties = _gobject.list_properties
-new = _gobject.new
-pygobject_version = _gobject.pygobject_version
+features = _gi.features
+list_properties = _gi.list_properties
+new = _gi.new
+pygobject_version = _gi.pygobject_version
threads_init = GLib.threads_init
-type_register = _gobject.type_register
+type_register = _gi.type_register
__all__ += ['features', 'list_properties', 'new',
'pygobject_version', 'threads_init', 'type_register']
@@ -228,15 +228,15 @@ class Value(GObjectModule.Value):
# Workaround the introspection marshalers inability to know
# these methods should be marshaling boxed types. This is because
# the type information is stored on the GValue.
- _gobject._gvalue_set(self, boxed)
+ _gi._gvalue_set(self, boxed)
def get_boxed(self):
- return _gobject._gvalue_get(self)
+ return _gi._gvalue_get(self)
def set_value(self, py_value):
gtype = self.g_type
- if gtype == _gobject.TYPE_INVALID:
+ if gtype == _gi.TYPE_INVALID:
raise TypeError("GObject.Value needs to be initialized first")
elif gtype == TYPE_BOOLEAN:
self.set_boolean(py_value)
@@ -527,8 +527,8 @@ __all__.append('signal_accumulator_true_handled')
# Statically bound signal functions which need to clobber GI (for now)
-add_emission_hook = _gobject.add_emission_hook
-signal_new = _gobject.signal_new
+add_emission_hook = _gi.add_emission_hook
+signal_new = _gi.signal_new
__all__ += ['add_emission_hook', 'signal_new']
@@ -596,23 +596,23 @@ class Object(GObjectModule.Object):
# The following methods are static APIs which need to leap frog the
# gi methods until we verify the gi methods can replace them.
- get_property = _gobject.GObject.get_property
- get_properties = _gobject.GObject.get_properties
- set_property = _gobject.GObject.set_property
- set_properties = _gobject.GObject.set_properties
- bind_property = _gobject.GObject.bind_property
- connect = _gobject.GObject.connect
- connect_after = _gobject.GObject.connect_after
- connect_object = _gobject.GObject.connect_object
- connect_object_after = _gobject.GObject.connect_object_after
- disconnect_by_func = _gobject.GObject.disconnect_by_func
- handler_block_by_func = _gobject.GObject.handler_block_by_func
- handler_unblock_by_func = _gobject.GObject.handler_unblock_by_func
- emit = _gobject.GObject.emit
- chain = _gobject.GObject.chain
- weak_ref = _gobject.GObject.weak_ref
- __copy__ = _gobject.GObject.__copy__
- __deepcopy__ = _gobject.GObject.__deepcopy__
+ get_property = _gi.GObject.get_property
+ get_properties = _gi.GObject.get_properties
+ set_property = _gi.GObject.set_property
+ set_properties = _gi.GObject.set_properties
+ bind_property = _gi.GObject.bind_property
+ connect = _gi.GObject.connect
+ connect_after = _gi.GObject.connect_after
+ connect_object = _gi.GObject.connect_object
+ connect_object_after = _gi.GObject.connect_object_after
+ disconnect_by_func = _gi.GObject.disconnect_by_func
+ handler_block_by_func = _gi.GObject.handler_block_by_func
+ handler_unblock_by_func = _gi.GObject.handler_unblock_by_func
+ emit = _gi.GObject.emit
+ chain = _gi.GObject.chain
+ weak_ref = _gi.GObject.weak_ref
+ __copy__ = _gi.GObject.__copy__
+ __deepcopy__ = _gi.GObject.__deepcopy__
def freeze_notify(self):
"""Freezes the object's property-changed notification queue.
@@ -648,9 +648,9 @@ class Object(GObjectModule.Object):
"""
flags = kwargs.get('connect_flags', 0)
if flags & GObjectModule.ConnectFlags.AFTER:
- connect_func = _gobject.GObject.connect_after
+ connect_func = _gi.GObject.connect_after
else:
- connect_func = _gobject.GObject.connect
+ connect_func = _gi.GObject.connect
if flags & GObjectModule.ConnectFlags.SWAPPED:
if len(data) != 1:
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index c5b9a39..bf1b9af 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -78,7 +78,6 @@ if hasattr(Gdk, 'Color'):
int(green * Color.MAX_VALUE),
int(blue * Color.MAX_VALUE))
-
Color = override(Color)
__all__.append('Color')
@@ -322,12 +321,15 @@ __all__.append('DragContext')
class Cursor(Gdk.Cursor):
+
def __new__(cls, *args, **kwds):
arg_len = len(args)
kwd_len = len(kwds)
total_len = arg_len + kwd_len
if total_len == 1:
+ if Gdk._version == "4.0":
+ raise ValueError("Wrong number of parameters")
# Since g_object_newv (super.__new__) does not seem valid for
# direct use with GdkCursor, we must assume usage of at least
# one of the C constructors to be valid.
diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py
index bb320a5..cdb3ccb 100644
--- a/gi/overrides/Gio.py
+++ b/gi/overrides/Gio.py
@@ -18,8 +18,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
+import warnings
+
from ..overrides import override, deprecated_init
from ..module import get_introspection_module
+from gi import PyGIWarning
from gi.repository import GLib
@@ -30,6 +33,22 @@ Gio = get_introspection_module('Gio')
__all__ = []
+class VolumeMonitor(Gio.VolumeMonitor):
+
+ def __init__(self, *args, **kwargs):
+ super(VolumeMonitor, self).__init__(*args, **kwargs)
+
+ # https://bugzilla.gnome.org/show_bug.cgi?id=744690
+ warnings.warn(
+ "Gio.VolumeMonitor shouldn't be instantiated directly, "
+ "use Gio.VolumeMonitor.get() instead.",
+ PyGIWarning, stacklevel=2)
+
+
+VolumeMonitor = override(VolumeMonitor)
+__all__.append('VolumeMonitor')
+
+
class FileEnumerator(Gio.FileEnumerator):
def __iter__(self):
return self
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 2c0e870..08d2612 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -30,10 +30,8 @@ from gi import PyGIDeprecationWarning
if sys.version_info >= (3, 0):
_basestring = str
- _callable = lambda c: hasattr(c, '__call__')
else:
_basestring = basestring
- _callable = callable
Gtk = get_introspection_module('Gtk')
@@ -91,7 +89,7 @@ def _extract_handler_and_args(obj_or_map, handler_name):
args = handler[1:]
handler = handler[0]
- elif not _callable(handler):
+ elif not callable(handler):
raise TypeError('Handler %s is not a method, function or tuple' % handler)
return handler, args
@@ -745,9 +743,6 @@ class TextBuffer(Gtk.TextBuffer):
self.apply_tag(tag, start, iter)
def insert_with_tags_by_name(self, iter, text, *tags):
- if not tags:
- return
-
tag_objs = []
for tag in tags:
diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in
index 6e0976d..61044db 100644
--- a/gi/overrides/Makefile.in
+++ b/gi/overrides/Makefile.in
@@ -89,10 +89,22 @@ build_triplet = @build@
host_triplet = @host@
subdir = gi/overrides
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
- $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+ $(top_srcdir)/m4/ax_append_flag.m4 \
+ $(top_srcdir)/m4/ax_append_link_flags.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_check_link_flag.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+ $(top_srcdir)/m4/ax_is_release.m4 \
+ $(top_srcdir)/m4/ax_require_defined.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -157,7 +169,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
@@ -180,7 +191,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
@@ -213,8 +223,14 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
@@ -247,14 +263,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
PYCAIRO_LIBS = @PYCAIRO_LIBS@
PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
@@ -262,15 +276,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py
index 942e6ed..e262b6c 100644
--- a/gi/overrides/__init__.py
+++ b/gi/overrides/__init__.py
@@ -165,20 +165,6 @@ def load_overrides(introspection_module):
return proxy
-class overridefunc(object):
- """decorator for overriding a function"""
- def __init__(self, func):
- if not isinstance(func, CallableInfo):
- raise TypeError("func must be a gi function, got %s" % func)
-
- module_name = func.__module__.rsplit('.', 1)[-1]
- self.module = sys.modules["gi.repository." + module_name]
-
- def __call__(self, func):
- setattr(self.module, func.__name__, func)
- return func
-
-
def override(type_):
"""Decorator for registering an override.
@@ -187,8 +173,18 @@ def override(type_):
for example), so they have to be added to the module immediately.
"""
- if isinstance(type_, (types.FunctionType, CallableInfo)):
- return overridefunc(type_)
+ if isinstance(type_, CallableInfo):
+ func = type_
+ namespace = func.__module__.rsplit('.', 1)[-1]
+ module = sys.modules["gi.repository." + namespace]
+
+ def wrapper(func):
+ setattr(module, func.__name__, func)
+ return func
+
+ return wrapper
+ elif isinstance(type_, types.FunctionType):
+ raise TypeError("func must be a gi function, got %s" % type_)
else:
try:
info = getattr(type_, '__info__')
@@ -214,6 +210,10 @@ def override(type_):
return type_
+overridefunc = override
+"""Deprecated"""
+
+
def deprecated(fn, replacement):
"""Decorator for marking methods and classes as deprecated"""
@wraps(fn)
diff --git a/gi/pygboxed.c b/gi/pygboxed.c
index 2eaff85..e521c96 100644
--- a/gi/pygboxed.c
+++ b/gi/pygboxed.c
@@ -22,6 +22,7 @@
# include <config.h>
#endif
+#include <Python.h>
#include <glib-object.h>
#include <pyglib.h>
@@ -39,9 +40,9 @@ static void
pyg_boxed_dealloc(PyGBoxed *self)
{
if (self->free_on_dealloc && pyg_boxed_get_ptr (self)) {
- PyGILState_STATE state = pyglib_gil_state_ensure();
+ PyGILState_STATE state = PyGILState_Ensure();
g_boxed_free (self->gtype, pyg_boxed_get_ptr (self));
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
Py_TYPE(self)->tp_free((PyObject *)self);
@@ -62,10 +63,10 @@ pyg_boxed_richcompare(PyObject *self, PyObject *other, int op)
}
-static long
+static PYGLIB_Py_hash_t
pyg_boxed_hash(PyGBoxed *self)
{
- return (long)pyg_boxed_get_ptr (self);
+ return PYGLIB_Py_hash_t_FromVoidPtr (pyg_boxed_get_ptr (self));
}
static PyObject *
@@ -203,11 +204,11 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
g_return_val_if_fail(boxed_type != 0, NULL);
g_return_val_if_fail(!copy_boxed || (copy_boxed && own_ref), NULL);
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
if (!boxed) {
Py_INCREF(Py_None);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return Py_None;
}
@@ -221,14 +222,14 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
if (!PyType_IsSubtype (tp, &PyGBoxed_Type)) {
PyErr_Format (PyExc_RuntimeError, "%s isn't a GBoxed", tp->tp_name);
- pyglib_gil_state_release (state);
+ PyGILState_Release (state);
return NULL;
}
self = (PyGBoxed *)tp->tp_alloc(tp, 0);
if (self == NULL) {
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return NULL;
}
@@ -238,7 +239,7 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
self->gtype = boxed_type;
self->free_on_dealloc = own_ref;
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return (PyObject *)self;
}
diff --git a/gi/pygenum.c b/gi/pygenum.c
index cea9c0f..6897d53 100644
--- a/gi/pygenum.c
+++ b/gi/pygenum.c
@@ -165,7 +165,7 @@ pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
* values might not have been that good", but we need to keep
* backward compatibility.
*/
- if (!PyDict_Check(values) || PyDict_Size(values) > eclass->n_values) {
+ if (!PyDict_Check(values) || (gsize)PyDict_Size(values) > eclass->n_values) {
PyErr_SetString(PyExc_TypeError, "__enum_values__ badly formed");
Py_DECREF(values);
g_type_class_unref(eclass);
@@ -235,7 +235,7 @@ pyg_enum_add (PyObject * module,
PyGILState_STATE state;
PyObject *instance_dict, *stub, *values, *o;
GEnumClass *eclass;
- int i;
+ guint i;
g_return_val_if_fail(typename != NULL, NULL);
if (!g_type_is_a (gtype, G_TYPE_ENUM)) {
@@ -244,7 +244,7 @@ pyg_enum_add (PyObject * module,
return NULL;
}
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* Create a new type derived from GEnum. This is the same as:
* >>> stub = type(typename, (GEnum,), {})
@@ -256,7 +256,7 @@ pyg_enum_add (PyObject * module,
Py_DECREF(instance_dict);
if (!stub) {
PyErr_SetString(PyExc_RuntimeError, "can't create const");
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return NULL;
}
@@ -309,7 +309,7 @@ pyg_enum_add (PyObject * module,
g_type_class_unref(eclass);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return stub;
}
diff --git a/gi/pygflags.c b/gi/pygflags.c
index 693fca0..fa12341 100644
--- a/gi/pygflags.c
+++ b/gi/pygflags.c
@@ -74,7 +74,7 @@ generate_repr(GType gtype, guint value)
{
GFlagsClass *flags_class;
char *retval = NULL, *tmp;
- int i;
+ guint i;
flags_class = g_type_class_ref(gtype);
g_assert(G_IS_FLAGS_CLASS(flags_class));
@@ -256,7 +256,7 @@ pyg_flags_add (PyObject * module,
PyGILState_STATE state;
PyObject *instance_dict, *stub, *values, *o;
GFlagsClass *eclass;
- int i;
+ guint i;
g_return_val_if_fail(typename != NULL, NULL);
if (!g_type_is_a(gtype, G_TYPE_FLAGS)) {
@@ -265,7 +265,7 @@ pyg_flags_add (PyObject * module,
return NULL;
}
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* Create a new type derived from GFlags. This is the same as:
* >>> stub = type(typename, (GFlags,), {})
@@ -277,7 +277,7 @@ pyg_flags_add (PyObject * module,
Py_DECREF(instance_dict);
if (!stub) {
PyErr_SetString(PyExc_RuntimeError, "can't create GFlags subtype");
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return NULL;
}
@@ -329,7 +329,7 @@ pyg_flags_add (PyObject * module,
g_type_class_unref(eclass);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return stub;
}
@@ -425,7 +425,7 @@ pyg_flags_get_value_names(PyGFlags *self, void *closure)
{
GFlagsClass *flags_class;
PyObject *retval;
- int i;
+ guint i;
flags_class = g_type_class_ref(self->gtype);
g_assert(G_IS_FLAGS_CLASS(flags_class));
@@ -445,7 +445,7 @@ pyg_flags_get_value_nicks(PyGFlags *self, void *closure)
{
GFlagsClass *flags_class;
PyObject *retval;
- int i;
+ guint i;
flags_class = g_type_class_ref(self->gtype);
g_assert(G_IS_FLAGS_CLASS(flags_class));
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 0929038..e6f9346 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -19,6 +19,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+#include <Python.h>
+
#include <string.h>
#include <time.h>
@@ -1269,6 +1271,8 @@ _pygi_argument_release (GIArgument *arg,
g_slice_free (GError *, arg->v_pointer);
break;
}
+ default:
+ break;
}
}
diff --git a/gi/pygi-array.c b/gi/pygi-array.c
index 61d0617..8dfab12 100644
--- a/gi/pygi-array.c
+++ b/gi/pygi-array.c
@@ -87,7 +87,7 @@ gi_argument_from_py_ssize_t (GIArgument *arg_out,
}
case GI_TYPE_TAG_UINT32:
- if (size_in >= 0 && size_in <= G_MAXUINT32) {
+ if (size_in >= 0 && (gsize)size_in <= G_MAXUINT32) {
arg_out->v_uint32 = size_in;
return TRUE;
} else {
@@ -185,7 +185,7 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
{
PyGIMarshalFromPyFunc from_py_marshaller;
int i = 0;
- int success_count = 0;
+ gsize success_count = 0;
Py_ssize_t length;
gssize item_size;
gboolean is_ptr_array;
@@ -360,15 +360,15 @@ err:
/* Only attempt per item cleanup on pointer items */
if (sequence_cache->item_cache->is_pointer) {
for(j = 0; j < success_count; j++) {
- PyObject *py_item = PySequence_GetItem (py_arg, j);
+ PyObject *py_seq_item = PySequence_GetItem (py_arg, j);
cleanup_func (state,
sequence_cache->item_cache,
- py_item,
+ py_seq_item,
is_ptr_array ?
g_ptr_array_index ((GPtrArray *)array_, j) :
g_array_index (array_, gpointer, j),
TRUE);
- Py_DECREF (py_item);
+ Py_DECREF (py_seq_item);
}
}
}
@@ -532,10 +532,10 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
}
} else {
GIArgument *len_arg = &state->args[array_cache->len_arg_index].arg_value;
- PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (callable_cache,
+ PyGIArgCache *sub_cache = _pygi_callable_cache_get_arg (callable_cache,
array_cache->len_arg_index);
- if (!gi_argument_to_gsize (len_arg, &len, arg_cache->type_tag)) {
+ if (!gi_argument_to_gsize (len_arg, &len, sub_cache->type_tag)) {
return NULL;
}
}
@@ -570,7 +570,7 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
if (arg->v_pointer == NULL) {
py_obj = PyList_New (0);
} else {
- int i;
+ guint i;
gsize item_size;
PyGIMarshalToPyFunc item_to_py_marshaller;
@@ -656,7 +656,7 @@ err:
} else {
/* clean up unprocessed items */
if (seq_cache->item_cache->to_py_cleanup != NULL) {
- int j;
+ guint j;
PyGIMarshalCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup;
for (j = processed_items; j < array_->len; j++) {
cleanup_func (state,
@@ -832,7 +832,7 @@ pygi_arg_garray_len_arg_setup (PyGIArgCache *arg_cache,
callable_cache->n_py_args -= 1;
for (i = seq_cache->len_arg_index + 1;
- i < _pygi_callable_cache_args_len (callable_cache); i++) {
+ (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
PyGIArgCache *update_cache = _pygi_callable_cache_get_arg (callable_cache, i);
if (update_cache == NULL)
break;
diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c
index 4a5e112..6d4e64e 100644
--- a/gi/pygi-basictype.c
+++ b/gi/pygi-basictype.c
@@ -246,53 +246,167 @@ _pygi_marshal_from_py_utf8 (PyObject *py_arg,
return TRUE;
}
-static gboolean
-_pygi_marshal_from_py_filename (PyObject *py_arg,
- GIArgument *arg,
- gpointer *cleanup_data)
+G_GNUC_UNUSED static gboolean
+_pygi_marshal_from_py_filename_unix (PyObject *py_arg,
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
- gchar *string_;
- GError *error = NULL;
- PyObject *tmp = NULL;
+ gchar *filename;
if (py_arg == Py_None) {
arg->v_pointer = NULL;
return TRUE;
}
- if (PyUnicode_Check (py_arg)) {
- tmp = PyUnicode_AsUTF8String (py_arg);
- if (!tmp)
+ if (PYGLIB_PyBytes_Check (py_arg)) {
+ char *buffer;
+
+ if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
return FALSE;
- string_ = PYGLIB_PyBytes_AsString (tmp);
- }
+ filename = g_strdup (buffer);
+ } else if (PyUnicode_Check (py_arg)) {
+ PyObject *bytes;
+ char *buffer;
+
#if PY_VERSION_HEX < 0x03000000
- else if (PyString_Check (py_arg)) {
- string_ = PyString_AsString (py_arg);
- }
+ bytes = PyUnicode_AsEncodedString (py_arg, Py_FileSystemDefaultEncoding,
+ NULL);
+#else
+ bytes = PyUnicode_EncodeFSDefault (py_arg);
#endif
- else {
- PyErr_Format (PyExc_TypeError, "Must be string, not %s",
+
+ if (!bytes)
+ return FALSE;
+
+ if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+ Py_DECREF (bytes);
+ return FALSE;
+ }
+
+ filename = g_strdup (buffer);
+ Py_DECREF (bytes);
+ } else {
+ PyErr_Format (PyExc_TypeError, "Must be bytes, not %s",
py_arg->ob_type->tp_name);
return FALSE;
}
- arg->v_string = g_filename_from_utf8 (string_, -1, NULL, NULL, &error);
- Py_XDECREF (tmp);
+ arg->v_string = filename;
+ *cleanup_data = filename;
+ return TRUE;
+}
- if (arg->v_string == NULL) {
- PyErr_SetString (PyExc_Exception, error->message);
- g_error_free (error);
- /* TODO: Convert the error to an exception. */
+G_GNUC_UNUSED static gboolean
+_pygi_marshal_from_py_filename_win32 (PyObject *py_arg,
+ GIArgument *arg,
+ gpointer *cleanup_data)
+{
+ gchar *filename;
+
+ if (py_arg == Py_None) {
+ arg->v_pointer = NULL;
+ return TRUE;
+ }
+
+#if PY_VERSION_HEX < 0x03000000
+ if (PYGLIB_PyBytes_Check (py_arg)) {
+ char *buffer;
+
+ if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
+ return FALSE;
+
+ filename = g_strdup (buffer);
+ } else if (PyUnicode_Check (py_arg)) {
+ PyObject *bytes;
+ char *buffer;
+
+ bytes = PyUnicode_AsUTF8String (py_arg);
+ if (!bytes)
+ return FALSE;
+
+ if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+ Py_DECREF (bytes);
+ return FALSE;
+ }
+
+ filename = g_strdup (buffer);
+ Py_DECREF (bytes);
+ } else {
+ PyErr_Format (PyExc_TypeError, "Must be unicode, not %s",
+ py_arg->ob_type->tp_name);
return FALSE;
}
+#else
+ if (PYGLIB_PyBytes_Check (py_arg)) {
+ PyObject *uni_arg;
+ gboolean result;
+ char *buffer;
- *cleanup_data = arg->v_string;
+ if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
+ return FALSE;
+
+ uni_arg = PyUnicode_DecodeFSDefault (buffer);
+ if (!uni_arg)
+ return FALSE;
+ result = _pygi_marshal_from_py_filename_win32 (uni_arg, arg, cleanup_data);
+ Py_DECREF (uni_arg);
+ return result;
+ } else if (PyUnicode_Check (py_arg)) {
+ PyObject *bytes, *temp_uni;
+ char *buffer;
+
+ /* The roundtrip merges lone surrogates, so we get the same output as
+ * with Py 2. Requires 3.4+ because of https://bugs.python.org/issue27971
+ * Separated lone surrogates can occur when concatenating two paths.
+ */
+ bytes = PyUnicode_AsEncodedString (py_arg, "utf-16-le", "surrogatepass");
+ if (!bytes)
+ return FALSE;
+ temp_uni = PyUnicode_FromEncodedObject (bytes, "utf-16-le", "surrogatepass");
+ Py_DECREF (bytes);
+ if (!temp_uni)
+ return FALSE;
+ /* glib uses utf-8, so encode to that and allow surrogates so we can
+ * represent all possible path values
+ */
+ bytes = PyUnicode_AsEncodedString (temp_uni, "utf-8", "surrogatepass");
+ Py_DECREF (temp_uni);
+ if (!bytes)
+ return FALSE;
+
+ if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+ Py_DECREF (bytes);
+ return FALSE;
+ }
+
+ filename = g_strdup (buffer);
+ Py_DECREF (bytes);
+ } else {
+ PyErr_Format (PyExc_TypeError, "Must be str, not %s",
+ py_arg->ob_type->tp_name);
+ return FALSE;
+ }
+#endif
+
+ arg->v_string = filename;
+ *cleanup_data = filename;
return TRUE;
}
static gboolean
+_pygi_marshal_from_py_filename (PyObject *py_arg,
+ GIArgument *arg,
+ gpointer *cleanup_data)
+{
+#ifdef G_OS_WIN32
+ return _pygi_marshal_from_py_filename_win32 (py_arg, arg, cleanup_data);
+#else
+ return _pygi_marshal_from_py_filename_unix (py_arg, arg, cleanup_data);
+#endif
+}
+
+static gboolean
_pygi_marshal_from_py_long (PyObject *object, /* in */
GIArgument *arg, /* out */
GITypeTag type_tag,
@@ -617,23 +731,23 @@ _pygi_marshal_to_py_utf8 (GIArgument *arg)
static PyObject *
_pygi_marshal_to_py_filename (GIArgument *arg)
{
- gchar *string = NULL;
- PyObject *py_obj = NULL;
- GError *error = NULL;
+ PyObject *py_obj;
if (arg->v_string == NULL) {
Py_RETURN_NONE;
}
- string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
- if (string == NULL) {
- PyErr_SetString (PyExc_Exception, error->message);
- /* TODO: Convert the error to an exception. */
- return NULL;
- }
-
- py_obj = PYGLIB_PyUnicode_FromString (string);
- g_free (string);
+#if PY_VERSION_HEX < 0x03000000
+ /* On PY2 we return str as is */
+ py_obj = PyString_FromString (arg->v_string);
+#else
+#ifdef G_OS_WIN32
+ py_obj = PyUnicode_DecodeUTF8 (arg->v_string, strlen(arg->v_string),
+ "surrogatepass");
+#else
+ py_obj = PyUnicode_DecodeFSDefault (arg->v_string);
+#endif
+#endif
return py_obj;
}
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 170b242..82a6182 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -428,6 +428,8 @@ pygi_arg_cache_new (GITypeInfo *type_info,
transfer,
direction);
break;
+ default:
+ break;
}
if (arg_cache != NULL) {
@@ -499,7 +501,7 @@ _callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache,
callable_cache->user_data_index = -1;
for (i = 0, arg_index = callable_cache->args_offset;
- arg_index < _pygi_callable_cache_args_len (callable_cache);
+ (gsize)arg_index < _pygi_callable_cache_args_len (callable_cache);
i++, arg_index++) {
PyGIArgCache *arg_cache = NULL;
GIArgInfo *arg_info;
@@ -973,14 +975,16 @@ _function_with_instance_cache_generate_args_cache_real (PyGICallableCache *calla
{
GIInterfaceInfo *interface_info;
PyGIArgCache *instance_cache;
+ GITransfer transfer;
interface_info = g_base_info_get_container ((GIBaseInfo *) callable_info);
+ transfer = g_callable_info_get_instance_ownership_transfer (callable_info);
instance_cache =
_arg_cache_new_for_interface (interface_info,
NULL,
NULL,
- GI_TRANSFER_NOTHING,
+ transfer,
PYGI_DIRECTION_FROM_PYTHON,
callable_cache);
@@ -1139,7 +1143,7 @@ pygi_closure_cache_new (GICallableInfo *info)
*
* See: https://bugzilla.gnome.org/show_bug.cgi?id=652115
*/
- for (i = 0; i < _pygi_callable_cache_args_len (callable_cache); i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
PyGIArgCache *arg_cache;
PyGIArgGArray *garray_cache;
PyGIArgCache *len_arg_cache;
@@ -1162,7 +1166,7 @@ pygi_closure_cache_new (GICallableInfo *info)
* do not recognize user_data/data arguments correctly.
*/
if (callable_cache->user_data_index == -1) {
- for (i = 0; i < _pygi_callable_cache_args_len (callable_cache); i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
PyGIArgCache *arg_cache;
arg_cache = g_ptr_array_index (callable_cache->args_cache, i);
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index a75e358..17b283f 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -204,7 +204,7 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
PyGICallableCache *cache,
void **args)
{
- gint i;
+ guint i;
for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
@@ -274,6 +274,9 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
}
break;
}
+ case GI_TYPE_TAG_UNICHAR:
+ state[i].arg_value.v_uint32 = * (guint32 *) args[i];
+ break;
case GI_TYPE_TAG_ERROR:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_GLIST:
@@ -345,7 +348,7 @@ _pygi_closure_convert_arguments (PyGIInvokeState *state,
gssize n_in_args = 0;
gssize i;
- for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
PyGIArgCache *arg_cache;
arg_cache = g_ptr_array_index (cache->args_cache, i);
@@ -447,7 +450,7 @@ _pygi_closure_set_out_arguments (PyGIInvokeState *state,
i_py_retval++;
}
- for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+ for (i = 0; (gsize)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) {
diff --git a/gi/pygi-error.c b/gi/pygi-error.c
index 45ca2eb..e3d8838 100644
--- a/gi/pygi-error.c
+++ b/gi/pygi-error.c
@@ -51,7 +51,7 @@ pygi_error_marshal_to_py (GError **error)
if (*error == NULL)
return NULL;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
exc_type = PyGError;
if (exception_table != NULL)
@@ -71,7 +71,7 @@ pygi_error_marshal_to_py (GError **error)
domain,
(*error)->code);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return exc_instance;
}
@@ -96,14 +96,14 @@ pygi_error_check (GError **error)
if (*error == NULL)
return FALSE;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
exc_instance = pygi_error_marshal_to_py (error);
PyErr_SetObject(PyGError, exc_instance);
Py_DECREF(exc_instance);
g_clear_error(error);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return TRUE;
}
diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c
index 8e76529..682cee2 100644
--- a/gi/pygi-foreign-cairo.c
+++ b/gi/pygi-foreign-cairo.c
@@ -21,8 +21,8 @@
* IN THE SOFTWARE.
*/
-#include <cairo.h>
#include <Python.h>
+#include <cairo.h>
#if PY_VERSION_HEX < 0x03000000
#include <pycairo.h>
@@ -367,6 +367,49 @@ cairo_pattern_from_gvalue (const GValue *value)
return PycairoPattern_FromPattern (pattern, NULL);
}
+#if defined(PycairoRegion_Type)
+
+static PyObject *
+cairo_region_to_arg (PyObject *value,
+ GIInterfaceInfo *interface_info,
+ GITransfer transfer,
+ GIArgument *arg)
+{
+ cairo_region_t *region;
+
+ g_assert (transfer == GI_TRANSFER_NOTHING);
+
+ region = ( (PycairoRegion*) value)->region;
+ if (!region) {
+ PyErr_SetString (PyExc_ValueError, "Region instance wrapping a NULL region");
+ return NULL;
+ }
+
+ arg->v_pointer = region;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+cairo_region_from_arg (GIInterfaceInfo *interface_info,
+ GITransfer transfer,
+ gpointer data)
+{
+ cairo_region_t *region = (cairo_region_t*) data;
+
+ if (transfer == GI_TRANSFER_NOTHING)
+ cairo_region_reference (region);
+
+ return PycairoRegion_FromRegion (region);
+}
+
+static PyObject *
+cairo_region_release (GIBaseInfo *base_info,
+ gpointer struct_)
+{
+ cairo_region_destroy ( (cairo_region_t*) struct_);
+ Py_RETURN_NONE;
+}
+#endif
static PyMethodDef _gi_cairo_functions[] = { {0,} };
PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
@@ -406,6 +449,14 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
cairo_font_options_from_arg,
cairo_font_options_release);
+#if defined(PycairoRegion_Type)
+ pygi_register_foreign_struct ("cairo",
+ "Region",
+ cairo_region_to_arg,
+ cairo_region_from_arg,
+ cairo_region_release);
+#endif
+
pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_CONTEXT,
cairo_context_from_gvalue,
cairo_context_to_gvalue);
diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c
index f74b1e7..84af1ec 100644
--- a/gi/pygi-foreign.c
+++ b/gi/pygi-foreign.c
@@ -50,7 +50,7 @@ init_foreign_structs (void)
static PyGIForeignStruct *
do_lookup (const gchar *namespace, const gchar *name)
{
- gint i;
+ guint i;
for (i = 0; i < foreign_structs->len; i++) {
PyGIForeignStruct *foreign_struct = \
g_ptr_array_index (foreign_structs, i);
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 9a1b025..1b33e9a 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -1108,6 +1108,8 @@ _pygi_g_type_tag_size (GITypeTag type_tag)
"Unable to know the size (assuming %s is not a pointer)",
g_type_tag_to_string (type_tag));
break;
+ default:
+ break;
}
return size;
@@ -1166,10 +1168,10 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
if (g_type_info_is_pointer (type_info)) {
size = sizeof (gpointer);
} else {
- GITypeTag type_tag;
+ GITypeTag enum_type_tag;
- type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info);
- size = _pygi_g_type_tag_size (type_tag);
+ enum_type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info);
+ size = _pygi_g_type_tag_size (enum_type_tag);
}
break;
case GI_INFO_TYPE_BOXED:
@@ -1207,6 +1209,8 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
case GI_TYPE_TAG_ERROR:
size = sizeof (gpointer);
break;
+ default:
+ break;
}
return size;
@@ -1429,6 +1433,9 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
g_base_info_unref (info);
break;
}
+ default:
+ g_assert_not_reached();
+ break;
}
g_base_info_unref ( (GIBaseInfo *) field_type_info);
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index 619fe40..fd9e474 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -89,7 +89,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
{
PyObject *combined_py_args = NULL;
Py_ssize_t n_py_args, n_py_kwargs, i;
- guint n_expected_args = cache->n_py_args;
+ gssize n_expected_args = cache->n_py_args;
GSList *l;
n_py_args = PyTuple_GET_SIZE (py_args);
@@ -107,7 +107,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
if (cache->user_data_varargs_index < 0 && n_expected_args < n_py_args) {
char *full_name = pygi_callable_cache_get_full_name (cache);
PyErr_Format (PyExc_TypeError,
- "%.200s() takes exactly %d %sargument%s (%zd given)",
+ "%.200s() takes exactly %zd %sargument%s (%zd given)",
full_name,
n_expected_args,
n_py_kwargs > 0 ? "non-keyword " : "",
@@ -194,7 +194,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
} else {
char *full_name = pygi_callable_cache_get_full_name (cache);
PyErr_Format (PyExc_TypeError,
- "%.200s() takes exactly %d %sargument%s (%zd given)",
+ "%.200s() takes exactly %zd %sargument%s (%zd given)",
full_name,
n_expected_args,
n_py_kwargs > 0 ? "non-keyword " : "",
@@ -414,7 +414,7 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGIFunctionCache *function_cac
return FALSE;
}
- for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
GIArgument *c_arg = &state->args[i].arg_value;
PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
PyObject *py_arg = NULL;
@@ -511,6 +511,9 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGIFunctionCache *function_cac
}
break;
+ default:
+ g_assert_not_reached();
+ break;
}
if (py_arg == _PyGIDefaultArgPlaceholder) {
diff --git a/gi/pygi-marshal-cleanup.c b/gi/pygi-marshal-cleanup.c
index b4d04bc..906be58 100644
--- a/gi/pygi-marshal-cleanup.c
+++ b/gi/pygi-marshal-cleanup.c
@@ -94,7 +94,7 @@ pygi_marshal_cleanup_args_from_py_marshal_success (PyGIInvokeState *state,
{
gssize i;
- for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i);
PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup;
gpointer cleanup_data = state->args[i].arg_cleanup_data;
@@ -164,7 +164,7 @@ pygi_marshal_cleanup_args_from_py_parameter_fail (PyGIInvokeState *state,
state->failed = TRUE;
- for (i = 0; i < _pygi_callable_cache_args_len (cache) && i <= failed_arg_index; i++) {
+ for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache) && i <= failed_arg_index; i++) {
PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i);
PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup;
gpointer cleanup_data = state->args[i].arg_cleanup_data;
diff --git a/gi/pygi-object.c b/gi/pygi-object.c
index 35a2790..8fd8ee0 100644
--- a/gi/pygi-object.c
+++ b/gi/pygi-object.c
@@ -58,6 +58,12 @@ _pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
}
gobj = pygobject_get (py_arg);
+ if (gobj == NULL) {
+ PyErr_Format(PyExc_RuntimeError, "object at %p of type %s is not initialized",
+ py_arg, Py_TYPE(py_arg)->tp_name);
+ return FALSE;
+ }
+
if (transfer == GI_TRANSFER_EVERYTHING) {
/* For transfer everything, add a new ref that the callee will take ownership of.
* Pythons existing ref to the GObject will be managed with the PyGObject wrapper.
diff --git a/gi/pygi-property.c b/gi/pygi-property.c
index 19cdb44..9978585 100644
--- a/gi/pygi-property.c
+++ b/gi/pygi-property.c
@@ -258,6 +258,9 @@ pygi_set_property_value (PyGObject *instance,
case GI_INFO_TYPE_ENUM:
g_value_set_enum (&value, arg.v_int);
break;
+ case GI_INFO_TYPE_FLAGS:
+ g_value_set_flags (&value, arg.v_uint);
+ break;
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_OBJECT:
g_value_set_object (&value, arg.v_pointer);
@@ -348,7 +351,7 @@ pygi_set_property_value (PyGObject *instance,
*/
GArray *arg_items = (GArray*) arg.v_pointer;
gchar** strings;
- int i;
+ guint i;
if (arg_items == NULL)
goto out;
diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c
index f2698d5..0cdc1e4 100644
--- a/gi/pygi-signal-closure.c
+++ b/gi/pygi-signal-closure.c
@@ -88,6 +88,7 @@ pygi_signal_closure_marshal(GClosure *closure,
signal_info = ((PyGISignalClosure *)closure)->signal_info;
n_sig_info_args = g_callable_info_get_n_args(signal_info);
+ g_assert_cmpint (n_sig_info_args, >=, 0);
/* the first argument to a signal callback is instance,
but instance is not counted in the introspection data */
sig_info_highest_arg = n_sig_info_args + 1;
@@ -110,7 +111,7 @@ pygi_signal_closure_marshal(GClosure *closure,
}
PyTuple_SetItem(params, i, item);
- } else if (i < sig_info_highest_arg) {
+ } else if (i < (guint)sig_info_highest_arg) {
GIArgInfo arg_info;
GITypeInfo type_info;
GITypeTag type_tag;
diff --git a/gi/pygi-signal-closure.h b/gi/pygi-signal-closure.h
index 92e1870..9ba8d6d 100644
--- a/gi/pygi-signal-closure.h
+++ b/gi/pygi-signal-closure.h
@@ -24,6 +24,7 @@
#ifndef __PYGI_SIGNAL_CLOSURE_H__
#define __PYGI_SIGNAL_CLOSURE_H__
+#include <Python.h>
#include <girepository.h>
#include "pygobject-internal.h"
diff --git a/gi/pygi-source.c b/gi/pygi-source.c
index 154b1cd..5305260 100644
--- a/gi/pygi-source.c
+++ b/gi/pygi-source.c
@@ -45,7 +45,7 @@ pyg_source_prepare(GSource *source, gint *timeout)
gboolean got_err = TRUE;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
t = PyObject_CallMethod(pysource->obj, "prepare", NULL);
@@ -81,7 +81,7 @@ bail:
Py_XDECREF(t);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return ret;
}
@@ -94,7 +94,7 @@ pyg_source_check(GSource *source)
gboolean ret;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
t = PyObject_CallMethod(pysource->obj, "check", NULL);
@@ -106,7 +106,7 @@ pyg_source_check(GSource *source)
Py_DECREF(t);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return ret;
}
@@ -119,7 +119,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
gboolean ret;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
if (callback) {
tuple = user_data;
@@ -141,7 +141,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
Py_DECREF(t);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return ret;
}
@@ -153,7 +153,7 @@ pyg_source_finalize(GSource *source)
PyObject *func, *t;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
func = PyObject_GetAttrString(pysource->obj, "finalize");
if (func) {
@@ -165,9 +165,11 @@ pyg_source_finalize(GSource *source)
} else {
Py_DECREF(t);
}
+ } else {
+ PyErr_Clear ();
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
static GSourceFuncs pyg_source_funcs =
diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c
index a4276a4..60d2585 100644
--- a/gi/pygi-struct-marshal.c
+++ b/gi/pygi-struct-marshal.c
@@ -125,9 +125,8 @@ pygi_arg_gvalue_from_py_marshal (PyObject *py_arg,
} else {
value = g_slice_new0 (GValue);
g_value_init (value, object_type);
- if (pyg_value_from_pyobject (value, py_arg) < 0) {
+ if (pyg_value_from_pyobject_with_error (value, py_arg) < 0) {
g_slice_free (GValue, value);
- PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GValue failed");
return FALSE;
}
}
diff --git a/gi/pygi-util.h b/gi/pygi-util.h
index c7a6ca7..c7bc1d5 100644
--- a/gi/pygi-util.h
+++ b/gi/pygi-util.h
@@ -1,6 +1,7 @@
#ifndef __PYGI_UTIL_H__
#define __PYGI_UTIL_H__
+#include <Python.h>
#include <glib.h>
#include "pygobject-internal.h"
#include <pyglib-python-compat.h>
diff --git a/gi/pygi-value.c b/gi/pygi-value.c
index 88faf63..443597c 100644
--- a/gi/pygi-value.c
+++ b/gi/pygi-value.c
@@ -157,6 +157,8 @@ _pygi_argument_from_g_value(const GValue *value,
case GI_TYPE_TAG_VOID:
arg.v_pointer = g_value_get_pointer (value);
break;
+ default:
+ break;
}
return arg;
@@ -173,15 +175,16 @@ pyg_value_array_from_pyobject(GValue *value,
PyObject *obj,
const GParamSpecValueArray *pspec)
{
- int len;
+ Py_ssize_t seq_len;
GValueArray *value_array;
- int i;
+ guint len, i;
- len = PySequence_Length(obj);
- if (len == -1) {
+ seq_len = PySequence_Length(obj);
+ if (seq_len == -1) {
PyErr_Clear();
return -1;
}
+ len = (guint)seq_len;
if (pspec && pspec->fixed_n_elements > 0 && len != pspec->fixed_n_elements)
return -1;
@@ -383,8 +386,17 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
g_value_set_boolean(value, PyObject_IsTrue(obj));
break;
case G_TYPE_INT:
- g_value_set_int(value, PYGLIB_PyLong_AsLong(obj));
+ {
+ glong val = PYGLIB_PyLong_AsLong(obj);
+ if (val == -1 && PyErr_Occurred ())
+ return -1;
+ if (val > G_MAXINT || val < G_MININT) {
+ PyErr_SetString(PyExc_OverflowError, "out of range for int property");
+ return -1;
+ }
+ g_value_set_int(value, (gint)val);
break;
+ }
case G_TYPE_UINT:
{
if (PYGLIB_PyLong_Check(obj)) {
@@ -567,7 +579,7 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
break;
}
case G_TYPE_PARAM:
- /* we need to support both the wrapped _gobject.GParamSpec and the GI
+ /* we need to support both the wrapped _gi.GParamSpec and the GI
* GObject.ParamSpec */
if (G_IS_PARAM_SPEC (pygobject_get (obj)))
g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj)));
diff --git a/gi/pygi-value.h b/gi/pygi-value.h
index ce2e902..5b2eac1 100644
--- a/gi/pygi-value.h
+++ b/gi/pygi-value.h
@@ -18,9 +18,9 @@
#ifndef __PYGI_VALUE_H__
#define __PYGI_VALUE_H__
+#include <Python.h>
#include <glib-object.h>
#include <girepository.h>
-#include <Python.h>
G_BEGIN_DECLS
diff --git a/gi/pyglib-python-compat.h b/gi/pyglib-python-compat.h
index 7b67d55..d6f7553 100644
--- a/gi/pyglib-python-compat.h
+++ b/gi/pyglib-python-compat.h
@@ -54,6 +54,7 @@
#define PYGLIB_PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PYGLIB_PyBytes_Resize _PyString_Resize
#define PYGLIB_PyBytes_AsString PyString_AsString
+#define PYGLIB_PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PYGLIB_PyBytes_Size PyString_Size
#define PYGLIB_PyBytes_Check PyString_Check
@@ -68,6 +69,8 @@
#define PYGLIB_PyLong_AS_LONG PyInt_AS_LONG
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+#define PYGLIB_Py_hash_t long
+
/* Python 2.7 lacks a PyInt_FromUnsignedLong function; use signed longs, and
* rely on PyInt_AsUnsignedLong() to interpret them correctly */
#define PYGLIB_PyLong_FromUnsignedLong PyInt_FromLong
@@ -187,11 +190,16 @@ PyTypeObject symbol = { \
#define PYGLIB_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
#define PYGLIB_PyBytes_Resize(o, len) _PyBytes_Resize(o, len)
#define PYGLIB_PyBytes_AsString PyBytes_AsString
+#define PYGLIB_PyBytes_AsStringAndSize PyBytes_AsStringAndSize
#define PYGLIB_PyBytes_Size PyBytes_Size
#define PYGLIB_PyBytes_Check PyBytes_Check
#define PYGLIB_PyNumber_Long PyNumber_Long
+#define PYGLIB_Py_hash_t Py_hash_t
+
#endif
+#define PYGLIB_Py_hash_t_FromVoidPtr(ptr) ((PYGLIB_Py_hash_t)(gintptr)(ptr))
+
#endif /* __PYGLIB_PYTHON_COMPAT_H__ */
diff --git a/gi/pyglib.c b/gi/pyglib.c
index b83d605..d21ba4d 100644
--- a/gi/pyglib.c
+++ b/gi/pyglib.c
@@ -79,9 +79,9 @@ _pyglib_destroy_notify(gpointer user_data)
PyObject *obj = (PyObject *)user_data;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_DECREF(obj);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
gboolean
@@ -93,7 +93,7 @@ _pyglib_handler_marshal(gpointer user_data)
g_return_val_if_fail(user_data != NULL, FALSE);
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
tuple = (PyObject *)user_data;
ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0),
@@ -106,7 +106,7 @@ _pyglib_handler_marshal(gpointer user_data)
Py_DECREF(ret);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return res;
}
diff --git a/gi/pyglib.h b/gi/pyglib.h
index 37bdfa5..d390f14 100644
--- a/gi/pyglib.h
+++ b/gi/pyglib.h
@@ -31,14 +31,6 @@ G_BEGIN_DECLS
typedef void (*PyGLibThreadsEnabledFunc) (void);
typedef void (*PyGLibThreadBlockFunc) (void);
-#ifdef DISABLE_THREADING
-# define pyglib_gil_state_ensure() PyGILState_LOCKED
-# define pyglib_gil_state_release(state) state
-#else
-# define pyglib_gil_state_ensure PyGILState_Ensure
-# define pyglib_gil_state_release PyGILState_Release
-#endif
-
GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
/* Private: for gobject <-> glib interaction only. */
diff --git a/gi/pygobject-object.c b/gi/pygobject-object.c
index b2fe471..ca82ffb 100644
--- a/gi/pygobject-object.c
+++ b/gi/pygobject-object.c
@@ -112,7 +112,7 @@ pygobject_data_free(PyGObjectData *data)
if (Py_IsInitialized()) {
state_saved = TRUE;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_DECREF(data->type);
/* We cannot use Py_BEGIN_ALLOW_THREADS here because this is inside
* a branch. */
@@ -140,7 +140,7 @@ pygobject_data_free(PyGObjectData *data)
if (state_saved && Py_IsInitialized ()) {
Py_BLOCK_THREADS; /* Restores _save */
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
}
@@ -206,7 +206,7 @@ typedef struct {
guint index;
} PyGPropsIter;
-PYGLIB_DEFINE_TYPE("gi._gobject.GPropsIter", PyGPropsIter_Type, PyGPropsIter);
+PYGLIB_DEFINE_TYPE("gi._gi.GPropsIter", PyGPropsIter_Type, PyGPropsIter);
static void
pyg_props_iter_dealloc(PyGPropsIter *self)
@@ -351,7 +351,7 @@ set_property_from_pspec(GObject *obj,
return TRUE;
}
-PYGLIB_DEFINE_TYPE("gi._gobject.GProps", PyGProps_Type, PyGProps);
+PYGLIB_DEFINE_TYPE("gi._gi.GProps", PyGProps_Type, PyGProps);
static int
PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue)
@@ -477,7 +477,7 @@ static PySequenceMethods _PyGProps_as_sequence = {
0
};
-PYGLIB_DEFINE_TYPE("gi._gobject.GPropsDescr", PyGPropsDescr_Type, PyObject);
+PYGLIB_DEFINE_TYPE("gi._gi.GPropsDescr", PyGPropsDescr_Type, PyObject);
static PyObject *
pyg_props_descr_descr_get(PyObject *self, PyObject *obj, PyObject *type)
@@ -606,7 +606,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
PyGObject *self;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* Avoid thread safety problems by using qdata for wrapper retrieval
* instead of the user data argument.
@@ -620,7 +620,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
Py_INCREF(self);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
/* Called when the inst_dict is first created; switches the
@@ -701,7 +701,7 @@ pyg_type_get_bases(GType gtype)
guint n_interfaces;
PyTypeObject *py_parent_type, *py_interface_type;
PyObject *bases;
- int i;
+ guint i;
if (G_UNLIKELY(gtype == G_TYPE_OBJECT))
return NULL;
@@ -747,7 +747,7 @@ pygobject_new_with_interfaces(GType gtype)
PyTypeObject *py_parent_type;
PyObject *bases;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
bases = pyg_type_get_bases(gtype);
py_parent_type = (PyTypeObject *) PyTuple_GetItem(bases, 0);
@@ -772,7 +772,7 @@ pygobject_new_with_interfaces(GType gtype)
if (type == NULL) {
PyErr_Print();
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return NULL;
}
@@ -797,7 +797,7 @@ pygobject_new_with_interfaces(GType gtype)
if (PyType_Ready(type) < 0) {
g_warning ("couldn't make the type `%s' ready", type->tp_name);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return NULL;
}
@@ -805,7 +805,7 @@ pygobject_new_with_interfaces(GType gtype)
Py_INCREF(type);
g_type_set_qdata(gtype, pygobject_class_key, type);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return type;
}
@@ -847,7 +847,7 @@ pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_
offsetof(PyTypeObject, tp_repr),
offsetof(PyTypeObject, tp_str),
offsetof(PyTypeObject, tp_print) };
- int i;
+ gsize i;
/* Happens when registering gobject.GObject itself, at least. */
if (!bases)
@@ -913,6 +913,8 @@ pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset,
* or interface has been registered for the given GType, then a new
* type will be created.
*
+ * Does not set an exception when NULL is returned.
+ *
* Returns: The wrapper class for the GObject or NULL if the
* GType has no registered type and a new type couldn't be created
*/
@@ -922,19 +924,22 @@ pygobject_lookup_class(GType gtype)
PyTypeObject *py_type;
if (gtype == G_TYPE_INTERFACE)
- return &PyGInterface_Type;
+ return &PyGInterface_Type;
py_type = g_type_get_qdata(gtype, pygobject_class_key);
if (py_type == NULL) {
- py_type = g_type_get_qdata(gtype, pyginterface_type_key);
+ py_type = g_type_get_qdata(gtype, pyginterface_type_key);
- if (py_type == NULL)
- py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
+ if (py_type == NULL) {
+ py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
+ PyErr_Clear ();
+ }
- if (py_type == NULL) {
- py_type = pygobject_new_with_interfaces(gtype);
- g_type_set_qdata(gtype, pyginterface_type_key, py_type);
- }
+ if (py_type == NULL) {
+ py_type = pygobject_new_with_interfaces(gtype);
+ PyErr_Clear ();
+ g_type_set_qdata(gtype, pyginterface_type_key, py_type);
+ }
}
return py_type;
@@ -1067,7 +1072,7 @@ pygobject_watch_closure(PyObject *self, GClosure *closure)
/* -------------- PyGObject behaviour ----------------- */
-PYGLIB_DEFINE_TYPE("gi._gobject.GObject", PyGObject_Type, PyGObject);
+PYGLIB_DEFINE_TYPE("gi._gi.GObject", PyGObject_Type, PyGObject);
static void
pygobject_dealloc(PyGObject *self)
@@ -1115,10 +1120,10 @@ pygobject_richcompare(PyObject *self, PyObject *other, int op)
op);
}
-static long
+static PYGLIB_Py_hash_t
pygobject_hash(PyGObject *self)
{
- return (long)self->obj;
+ return PYGLIB_Py_hash_t_FromVoidPtr (self->obj);
}
static PyObject *
@@ -1459,10 +1464,10 @@ pygbinding_closure_invalidate(gpointer data, GClosure *closure)
PyGClosure *pc = (PyGClosure *)closure;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_XDECREF(pc->callback);
Py_XDECREF(pc->extra_args);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
pc->callback = NULL;
pc->extra_args = NULL;
@@ -1481,7 +1486,7 @@ pygbinding_marshal (GClosure *closure,
PyObject *params, *ret;
GValue *out_value;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* construct Python tuple for the parameter values */
params = PyTuple_New(2);
@@ -1516,7 +1521,7 @@ pygbinding_marshal (GClosure *closure,
out:
Py_DECREF(params);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
static GClosure *
@@ -1837,7 +1842,7 @@ pygobject_emit(PyGObject *self, PyObject *args)
return NULL;
}
g_signal_query(signal_id, &query);
- if (len != query.n_params + 1) {
+ if ((gsize)len != query.n_params + 1) {
gchar buf[128];
g_snprintf(buf, sizeof(buf),
@@ -1922,7 +1927,7 @@ pygobject_chain_from_overridden(PyGObject *self, PyObject *args)
return NULL;
}
g_signal_query(signal_id, &query);
- if (len != query.n_params) {
+ if (len < 0 || (gsize)len != query.n_params) {
gchar buf[128];
g_snprintf(buf, sizeof(buf),
@@ -2201,7 +2206,7 @@ typedef struct {
gboolean have_floating_ref;
} PyGObjectWeakRef;
-PYGLIB_DEFINE_TYPE("gi._gobject.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef);
+PYGLIB_DEFINE_TYPE("gi._gi.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef);
static int
pygobject_weak_ref_traverse(PyGObjectWeakRef *self, visitproc visit, void *arg)
@@ -2219,7 +2224,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
self->obj = NULL;
if (self->callback) {
PyObject *retval;
- PyGILState_STATE state = pyglib_gil_state_ensure();
+ PyGILState_STATE state = PyGILState_Ensure();
retval = PyObject_Call(self->callback, self->user_data, NULL);
if (retval) {
if (retval != Py_None)
@@ -2237,7 +2242,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
self->have_floating_ref = FALSE;
Py_DECREF((PyObject *) self);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
}
@@ -2326,9 +2331,9 @@ pyobject_copy(gpointer boxed)
PyObject *object = boxed;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_INCREF(object);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return object;
}
@@ -2338,9 +2343,9 @@ pyobject_free(gpointer boxed)
PyObject *object = boxed;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_DECREF(object);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
void
@@ -2405,7 +2410,7 @@ pygobject_object_register_types(PyObject *d)
descr = PyObject_New(PyObject, &PyGPropsDescr_Type);
PyDict_SetItemString(PyGObject_Type.tp_dict, "props", descr);
PyDict_SetItemString(PyGObject_Type.tp_dict, "__module__",
- o=PYGLIB_PyUnicode_FromString("gi._gobject._gobject"));
+ o=PYGLIB_PyUnicode_FromString("gi._gi"));
Py_DECREF(o);
/* GPropsIter */
diff --git a/gi/pygobject.h b/gi/pygobject.h
index 9e45dde..3762429 100644
--- a/gi/pygobject.h
+++ b/gi/pygobject.h
@@ -208,21 +208,12 @@ struct _PyGObject_Functions {
};
-#ifdef DISABLE_THREADING
-# define pyg_threads_enabled FALSE
-# define pyg_gil_state_ensure() 0
-# define pyg_gil_state_release(state)
-# define pyg_begin_allow_threads G_STMT_START {
-# define pyg_end_allow_threads } G_STMT_END
-#else
-# define pyg_threads_enabled TRUE
-# define pyg_gil_state_ensure PyGILState_Ensure
-# define pyg_gil_state_release PyGILState_Release
-# define pyg_begin_allow_threads Py_BEGIN_ALLOW_THREADS
-# define pyg_end_allow_threads Py_END_ALLOW_THREADS
-#endif
-
/* Deprecated, only available for API compatibility. */
+#define pyg_threads_enabled TRUE
+#define pyg_gil_state_ensure PyGILState_Ensure
+#define pyg_gil_state_release PyGILState_Release
+#define pyg_begin_allow_threads Py_BEGIN_ALLOW_THREADS
+#define pyg_end_allow_threads Py_END_ALLOW_THREADS
#define pyg_enable_threads()
#define pyg_set_thread_block_funcs(a, b)
#define pyg_block_threads()
diff --git a/gi/pygoptioncontext.c b/gi/pygoptioncontext.c
index 3b2babd..50c32fb 100644
--- a/gi/pygoptioncontext.c
+++ b/gi/pygoptioncontext.c
@@ -26,7 +26,7 @@
#include "pygoptioncontext.h"
#include "pygi-error.h"
-PYGLIB_DEFINE_TYPE("gi._glib.OptionContext", PyGOptionContext_Type, PyGOptionContext)
+PYGLIB_DEFINE_TYPE("gi._gi.OptionContext", PyGOptionContext_Type, PyGOptionContext)
/**
* pyg_option_context_new:
@@ -56,7 +56,7 @@ pyg_option_context_init(PyGOptionContext *self,
{
char *parameter_string;
- if (!PyArg_ParseTuple(args, "s:gi._glib.GOptionContext.__init__",
+ if (!PyArg_ParseTuple(args, "s:gi._gi.GOptionContext.__init__",
&parameter_string))
return -1;
diff --git a/gi/pygoptiongroup.c b/gi/pygoptiongroup.c
index bd57489..e91ca05 100644
--- a/gi/pygoptiongroup.c
+++ b/gi/pygoptiongroup.c
@@ -26,7 +26,7 @@
#include "pygoptiongroup.h"
#include "pygi-error.h"
-PYGLIB_DEFINE_TYPE("gi._glib.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup)
+PYGLIB_DEFINE_TYPE("gi._gi.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup)
/**
* pyg_option_group_new:
@@ -60,7 +60,7 @@ check_if_owned(PyGOptionGroup *self)
if (self->other_owner)
{
PyErr_SetString(PyExc_ValueError, "The GOptionGroup was not created by "
- "gi._glib.OptionGroup(), so operation is not possible.");
+ "gi._gi.OptionGroup(), so operation is not possible.");
return TRUE;
}
return FALSE;
@@ -70,7 +70,7 @@ static void
destroy_g_group(PyGOptionGroup *self)
{
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
self->group = NULL;
Py_CLEAR(self->callback);
@@ -83,7 +83,7 @@ destroy_g_group(PyGOptionGroup *self)
Py_DECREF(self);
}
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
static int
@@ -137,8 +137,7 @@ arg_func(const gchar *option_name,
PyGILState_STATE state;
gboolean no_error;
- state = pyglib_gil_state_ensure();
-
+ state = PyGILState_Ensure();
if (value == NULL)
ret = PyObject_CallFunction(self->callback, "sOO",
option_name, Py_None, self);
@@ -153,7 +152,7 @@ arg_func(const gchar *option_name,
} else
no_error = pygi_gerror_exception_check(error) != -1;
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return no_error;
}
diff --git a/gi/pygparamspec.c b/gi/pygparamspec.c
index 0982b99..4ace96c 100644
--- a/gi/pygparamspec.c
+++ b/gi/pygparamspec.c
@@ -46,10 +46,10 @@ pyg_param_spec_richcompare(PyObject *self, PyObject *other, int op)
}
}
-static long
+static PYGLIB_Py_hash_t
pyg_param_spec_hash(PyGParamSpec *self)
{
- return (long)pyg_param_spec_get (self);
+ return PYGLIB_Py_hash_t_FromVoidPtr (pyg_param_spec_get (self));
}
static PyObject *
diff --git a/gi/pygpointer.c b/gi/pygpointer.c
index 64ca983..dccd303 100644
--- a/gi/pygpointer.c
+++ b/gi/pygpointer.c
@@ -53,10 +53,10 @@ pyg_pointer_richcompare(PyObject *self, PyObject *other, int op)
}
}
-static long
+static PYGLIB_Py_hash_t
pyg_pointer_hash(PyGPointer *self)
{
- return (long)pyg_pointer_get_ptr (self);
+ return PYGLIB_Py_hash_t_FromVoidPtr (pyg_pointer_get_ptr (self));
}
static PyObject *
@@ -64,8 +64,9 @@ pyg_pointer_repr(PyGPointer *self)
{
gchar buf[128];
- g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", g_type_name(self->gtype),
- (long)pyg_pointer_get_ptr (self));
+ g_snprintf(buf, sizeof(buf), "<%s at 0x%" G_GUINTPTR_FORMAT ">",
+ g_type_name(self->gtype),
+ (guintptr)pyg_pointer_get_ptr (self));
return PYGLIB_PyUnicode_FromString(buf);
}
@@ -153,11 +154,11 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
PyTypeObject *tp;
g_return_val_if_fail(pointer_type != 0, NULL);
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
if (!pointer) {
Py_INCREF(Py_None);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return Py_None;
}
@@ -170,7 +171,7 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */
self = PyObject_NEW(PyGPointer, tp);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
if (self == NULL)
return NULL;
diff --git a/gi/pygspawn.c b/gi/pygspawn.c
index c66c50f..7828d23 100644
--- a/gi/pygspawn.c
+++ b/gi/pygspawn.c
@@ -32,12 +32,22 @@ struct _PyGChildSetupData {
PyObject *data;
};
-PYGLIB_DEFINE_TYPE("gi._glib.Pid", PyGPid_Type, PYGLIB_PyLongObject)
+PYGLIB_DEFINE_TYPE("gi._gi.Pid", PyGPid_Type, PYGLIB_PyLongObject)
+
+static GPid
+pyg_pid_get_pid (PyObject *self)
+{
+#ifdef G_OS_WIN32
+ return (GPid)PyLong_AsVoidPtr (self);
+#else
+ return (GPid)PYGLIB_PyLong_AsLong (self);
+#endif
+}
static PyObject *
pyg_pid_close(PyObject *self, PyObject *args, PyObject *kwargs)
{
- g_spawn_close_pid(PYGLIB_PyLong_AsLong(self));
+ g_spawn_close_pid(pyg_pid_get_pid (self));
Py_INCREF(Py_None);
return Py_None;
}
@@ -50,22 +60,28 @@ static PyMethodDef pyg_pid_methods[] = {
static void
pyg_pid_free(PyObject *gpid)
{
- g_spawn_close_pid((GPid) PYGLIB_PyLong_AsLong(gpid));
+ g_spawn_close_pid(pyg_pid_get_pid (gpid));
PYGLIB_PyLong_Type.tp_free((void *) gpid);
}
static int
pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs)
{
- PyErr_SetString(PyExc_TypeError, "gi._glib.Pid cannot be manually instantiated");
+ PyErr_SetString(PyExc_TypeError, "gi._gi.Pid cannot be manually instantiated");
return -1;
}
PyObject *
pyg_pid_new(GPid pid)
{
- return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "Oi",
- &PyGPid_Type, pid);
+ PyObject *long_val;
+#ifdef G_OS_WIN32
+ long_val = PyLong_FromVoidPtr (pid);
+#else
+ long_val = PYGLIB_PyLong_FromLong (pid);
+#endif
+ return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "ON",
+ &PyGPid_Type, long_val);
}
static void
@@ -76,7 +92,7 @@ _pyg_spawn_async_callback(gpointer user_data)
PyGILState_STATE gil;
data = (struct _PyGChildSetupData *) user_data;
- gil = pyglib_gil_state_ensure();
+ gil = PyGILState_Ensure();
if (data->data)
retval = PyObject_CallFunction(data->func, "O", data->data);
else
@@ -88,7 +104,7 @@ _pyg_spawn_async_callback(gpointer user_data)
Py_DECREF(data->func);
Py_XDECREF(data->data);
g_slice_free(struct _PyGChildSetupData, data);
- pyglib_gil_state_release(gil);
+ PyGILState_Release(gil);
}
PyObject *
@@ -106,10 +122,10 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
gint *standard_input, *standard_output, *standard_error;
struct _PyGChildSetupData *callback_data = NULL;
GError *error = NULL;
- GPid child_pid = -1;
+ GPid child_pid = 0;
Py_ssize_t len, i;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._glib.spawn_async",
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._gi.spawn_async",
kwlist,
&pyargv, &pyenvp, &working_directory, &flags,
&func, &user_data,
@@ -134,7 +150,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
/* parse argv */
if (!PySequence_Check(pyargv)) {
PyErr_SetString(PyExc_TypeError,
- "gi._glib.spawn_async: "
+ "gi._gi.spawn_async: "
"first argument must be a sequence of strings");
return NULL;
}
@@ -144,7 +160,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
PyObject *tmp = PySequence_ITEM(pyargv, i);
if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) {
PyErr_SetString(PyExc_TypeError,
- "gi._glib.spawn_async: "
+ "gi._gi.spawn_async: "
"first argument must be a sequence of strings");
g_free(argv);
Py_XDECREF(tmp);
@@ -158,7 +174,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
if (pyenvp) {
if (!PySequence_Check(pyenvp)) {
PyErr_SetString(PyExc_TypeError,
- "gi._glib.spawn_async: "
+ "gi._gi.spawn_async: "
"second argument must be a sequence of strings");
g_free(argv);
return NULL;
@@ -169,7 +185,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
PyObject *tmp = PySequence_ITEM(pyenvp, i);
if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) {
PyErr_SetString(PyExc_TypeError,
- "gi._glib.spawn_async: "
+ "gi._gi.spawn_async: "
"second argument must be a sequence of strings");
g_free(envp);
Py_XDECREF(tmp);
diff --git a/gi/pygtype.c b/gi/pygtype.c
index 32132ad..85a6d82 100644
--- a/gi/pygtype.c
+++ b/gi/pygtype.c
@@ -670,11 +670,11 @@ pyg_closure_invalidate(gpointer data, GClosure *closure)
PyGClosure *pc = (PyGClosure *)closure;
PyGILState_STATE state;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
Py_XDECREF(pc->callback);
Py_XDECREF(pc->extra_args);
Py_XDECREF(pc->swap_data);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
pc->callback = NULL;
pc->extra_args = NULL;
@@ -694,7 +694,7 @@ pyg_closure_marshal(GClosure *closure,
PyObject *params, *ret;
guint i;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
/* construct Python tuple for the parameter values */
params = PyTuple_New(n_param_values);
@@ -754,7 +754,7 @@ pyg_closure_marshal(GClosure *closure,
out:
Py_DECREF(params);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
/**
@@ -847,7 +847,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
PyObject *params, *ret;
guint i, len;
- state = pyglib_gil_state_ensure();
+ state = PyGILState_Ensure();
g_return_if_fail(invocation_hint != NULL);
/* get the object passed as the first argument to the closure */
@@ -873,7 +873,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
if (!method) {
PyErr_Clear();
Py_DECREF(object_wrapper);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return;
}
Py_DECREF(object_wrapper);
@@ -887,7 +887,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
/* error condition */
if (!item) {
Py_DECREF(params);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return;
}
PyTuple_SetItem(params, i - 1, item);
@@ -915,7 +915,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
PyErr_Print();
Py_DECREF(method);
Py_DECREF(params);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
return;
}
Py_DECREF(method);
@@ -923,7 +923,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
if (G_IS_VALUE(return_value))
pyg_value_from_pyobject(return_value, ret);
Py_DECREF(ret);
- pyglib_gil_state_release(state);
+ PyGILState_Release(state);
}
/**
diff --git a/gi/pygtype.h b/gi/pygtype.h
index 82c2523..7caf77c 100644
--- a/gi/pygtype.h
+++ b/gi/pygtype.h
@@ -21,8 +21,8 @@
#ifndef __PYGOBJECT_TYPE_H__
#define __PYGOBJECT_TYPE_H__
-#include <glib-object.h>
#include <Python.h>
+#include <glib-object.h>
#include "pygobject-internal.h"
#define PYGOBJECT_REGISTER_GTYPE(d, type, name, gtype) \
diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in
index 08de64c..91d8e17 100644
--- a/gi/repository/Makefile.in
+++ b/gi/repository/Makefile.in
@@ -89,10 +89,22 @@ build_triplet = @build@
host_triplet = @host@
subdir = gi/repository
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
- $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+ $(top_srcdir)/m4/ax_append_flag.m4 \
+ $(top_srcdir)/m4/ax_append_link_flags.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_check_link_flag.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+ $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+ $(top_srcdir)/m4/ax_is_release.m4 \
+ $(top_srcdir)/m4/ax_require_defined.m4 \
+ $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -157,7 +169,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
@@ -180,7 +191,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
@@ -213,8 +223,14 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
@@ -247,14 +263,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
PYCAIRO_LIBS = @PYCAIRO_LIBS@
PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
@@ -262,15 +276,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
diff --git a/gi/types.py b/gi/types.py
index 9d3cb0c..9bc3779 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -35,11 +35,10 @@ from ._gi import \
VFuncInfo, \
register_interface_info, \
hook_up_vfunc_implementation, \
- _gobject
+ GInterface
+from . import _gi
-GInterface = _gobject.GInterface
-
-StructInfo # pyflakes
+StructInfo, GInterface # pyflakes
from . import _propertyhelper as propertyhelper
from . import _signalhelper as signalhelper
@@ -147,7 +146,7 @@ def find_vfunc_info_in_interface(bases, vfunc_name):
# This can be seen in IntrospectionModule.__getattr__() in module.py.
# We do not need to search regular classes here, only wrapped interfaces.
# We also skip GInterface, because it is not wrapped and has no __info__ attr.
- # Skip bases without __info__ (static _gobject._gobject.GObject)
+ # Skip bases without __info__ (static _gi.GObject)
if base is GInterface or\
not issubclass(base, GInterface) or\
not hasattr(base, '__info__'):
@@ -202,10 +201,10 @@ class _GObjectMetaBase(type):
if cls.__module__.startswith('gi.overrides.'):
return
- _gobject.type_register(cls, namespace.get('__gtype_name__'))
+ _gi.type_register(cls, namespace.get('__gtype_name__'))
-_gobject._install_metaclass(_GObjectMetaBase)
+_gi._install_metaclass(_GObjectMetaBase)
class GObjectMeta(_GObjectMetaBase, MetaClassHelper):