diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:48:16 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:48:19 +0900 |
commit | 2af8b46dbcf9e73f2ca40ea26cab5ab7ccac5d2a (patch) | |
tree | 5b4e30d98b770811a333c49562b319bd1f8e9224 /gi/overrides | |
parent | 3b5dc6176476d5ed2313cd7185d985f47e225165 (diff) | |
download | pygobject2-2af8b46dbcf9e73f2ca40ea26cab5ab7ccac5d2a.tar.gz pygobject2-2af8b46dbcf9e73f2ca40ea26cab5ab7ccac5d2a.tar.bz2 pygobject2-2af8b46dbcf9e73f2ca40ea26cab5ab7ccac5d2a.zip |
Imported Upstream version 3.7.3
Change-Id: I340c8ed6916f5312452a0b7b1bf0f0b7a2d91264
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/overrides')
-rw-r--r-- | gi/overrides/GLib.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py index ed63679..6ae5dba 100644 --- a/gi/overrides/GLib.py +++ b/gi/overrides/GLib.py @@ -490,8 +490,12 @@ class MainLoop(GLib.MainLoop): loop.quit() loop._quit_by_sigint = True - self._signal_source = GLib.unix_signal_add_full( - GLib.PRIORITY_DEFAULT, signal.SIGINT, _handler, self) + # compatibility shim, keep around until we depend on glib 2.36 + if hasattr(GLib, 'unix_signal_add'): + fn = GLib.unix_signal_add + else: + fn = GLib.unix_signal_add_full + self._signal_source = fn(GLib.PRIORITY_DEFAULT, signal.SIGINT, _handler, self) def __del__(self): GLib.source_remove(self._signal_source) @@ -639,9 +643,10 @@ __all__.append('timeout_add_seconds') # The real GLib API is io_add_watch(IOChannel, priority, condition, callback, -# user_data). This needs to take into account several deprecated APIs: +# user_data). This needs to take into account several historical APIs: # - calling with an fd as first argument -# - calling with a Python file object as first argument +# - calling with a Python file object as first argument (we keep this one as +# it's really convenient and does not change the number of arguments) # - calling without a priority as second argument # and the usual "call without or multiple user_data", in which case the # callback gets the same user data arguments. @@ -673,14 +678,10 @@ def io_add_watch(channel, priority_, condition, *cb_and_user_data, **kwargs): # backwards compatibility: Allow calling with fd if isinstance(channel, int): - warnings.warn('Calling io_add_watch with a file descriptor is deprecated; call it with a GLib.IOChannel object', - PyGIDeprecationWarning) func_fdtransform = lambda _, cond, data: func(channel, cond, data) real_channel = GLib.IOChannel.unix_new(channel) elif hasattr(channel, 'fileno'): # backwards compatibility: Allow calling with Python file - warnings.warn('Calling io_add_watch with a file object is deprecated; call it with a GLib.IOChannel object', - PyGIDeprecationWarning) func_fdtransform = lambda _, cond, data: func(channel, cond, data) real_channel = GLib.IOChannel.unix_new(channel.fileno()) else: @@ -837,15 +838,18 @@ def filename_from_utf8(utf8string, len=-1): __all__.append('filename_from_utf8') +# backwards compatible API for renamed function +if not hasattr(GLib, 'unix_signal_add_full'): + def add_full_compat(*args): + warnings.warn('GLib.unix_signal_add_full() was renamed to GLib.unix_signal_add()', + PyGIDeprecationWarning) + return GLib.unix_signal_add(*args) + + GLib.unix_signal_add_full = add_full_compat + + # obsolete constants for backwards compatibility glib_version = (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) __all__.append('glib_version') pyglib_version = version_info __all__.append('pyglib_version') - -# work around wrong constants in GLib GIR, see -# https://bugzilla.gnome.org/show_bug.cgi?id=685022 -MININT64 = -9223372036854775808 -MAXUINT64 = 18446744073709551615 -__all__.append('MININT64') -__all__.append('MAXUINT64') |