summaryrefslogtreecommitdiff
path: root/gi/__init__.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:49:08 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:49:11 +0900
commitb610f1b69cda55bd608e08b46058d0f2331d747c (patch)
treeb2b1eff58ee20266a539b8015c943eb4e118ebaa /gi/__init__.py
parented14d55c2e6e867dceed5b50d601d4d83a838619 (diff)
downloadpygobject2-b610f1b69cda55bd608e08b46058d0f2331d747c.tar.gz
pygobject2-b610f1b69cda55bd608e08b46058d0f2331d747c.tar.bz2
pygobject2-b610f1b69cda55bd608e08b46058d0f2331d747c.zip
Imported Upstream version 3.7.92
Change-Id: If39c9ad5ef13fc3c0878d49aa5859a63b663c4cd Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/__init__.py')
-rw-r--r--gi/__init__.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/gi/__init__.py b/gi/__init__.py
index 70a4917..e8c12db 100644
--- a/gi/__init__.py
+++ b/gi/__init__.py
@@ -83,7 +83,15 @@ def get_required_version(namespace):
return _versions.get(namespace, None)
-# note, DeprecationWarning would be more suitable as a base, but this
-# unhelpfully isn't shown by default and thus useless
-class PyGIDeprecationWarning(RuntimeWarning):
+# Use RuntimeWarning as the base class of PyGIDeprecationWarning
+# for unstable (odd minor version) and use DeprecationWarning for
+# stable (even minor version). This is so PyGObject deprecations
+# behave the same as regular Python deprecations in stable releases.
+if version_info[1] % 2:
+ _DeprecationWarningBase = RuntimeWarning
+else:
+ _DeprecationWarningBase = DeprecationWarning
+
+
+class PyGIDeprecationWarning(_DeprecationWarningBase):
pass