[pygobject/pypy-progress] pypy: pass a warning subclass to PyErr_Warn and not an exception, pypy does't support that.
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pypy-progress] pypy: pass a warning subclass to PyErr_Warn and not an exception, pypy does't support that.
- Date: Sun, 22 Apr 2018 19:34:59 +0000 (UTC)
commit 889264f8505e9a28beec1aeeac793c4b4744428e
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sun Apr 22 21:28:08 2018 +0200
pypy: pass a warning subclass to PyErr_Warn and not an exception, pypy does't support that.
TypeError is wrong there anyway.
gi/pygi-boxed.c | 2 +-
tests/test_everything.py | 2 +-
tests/test_gi.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c
index ce3d7487..d4823263 100644
--- a/gi/pygi-boxed.c
+++ b/gi/pygi-boxed.c
@@ -140,7 +140,7 @@ boxed_init (PyObject *self,
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) {
PyErr_Clear ();
- PyErr_Warn (PyExc_TypeError,
+ PyErr_Warn (PyExc_DeprecationWarning,
"Passing arguments to gi.types.Boxed.__init__() is deprecated. "
"All arguments passed will be ignored.");
}
diff --git a/tests/test_everything.py b/tests/test_everything.py
index f218928d..76543f7a 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -1330,7 +1330,7 @@ class TestBoxed(unittest.TestCase):
with warnings.catch_warnings(record=True) as warn:
warnings.simplefilter('always')
boxed = Everything.TestBoxedB(42, 47)
- self.assertTrue(issubclass(warn[0].category, TypeError))
+ self.assertTrue(issubclass(warn[0].category, DeprecationWarning))
self.assertEqual(boxed.some_int8, 0)
self.assertEqual(boxed.some_long, 0)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 51a9ecd0..3d87662e 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2246,13 +2246,13 @@ class TestStructure(unittest.TestCase):
warnings.simplefilter('always')
GIMarshallingTests.Union(42)
- self.assertTrue(issubclass(warn[0].category, TypeError))
+ self.assertTrue(issubclass(warn[0].category, DeprecationWarning))
with warnings.catch_warnings(record=True) as warn:
warnings.simplefilter('always')
GIMarshallingTests.Union(f=42)
- self.assertTrue(issubclass(warn[0].category, TypeError))
+ self.assertTrue(issubclass(warn[0].category, DeprecationWarning))
def test_union(self):
union = GIMarshallingTests.Union()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]