[pygobject/pygobject-3-28] resulttuple: fix a wrong decref
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-28] resulttuple: fix a wrong decref
- Date: Sun, 25 Mar 2018 18:43:11 +0000 (UTC)
commit 8eb973ec4cafa6bbedb47e8d12bd02e6ed318273
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sun Mar 25 19:12:54 2018 +0200
resulttuple: fix a wrong decref
We don't get ownership here so don't unref.
Thist function is only used in the test suite.
gi/pygi-resulttuple.c | 2 --
tests/test_resulttuple.py | 6 ++++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygi-resulttuple.c b/gi/pygi-resulttuple.c
index 8ddfeae3..d2d89a74 100644
--- a/gi/pygi-resulttuple.c
+++ b/gi/pygi-resulttuple.c
@@ -149,13 +149,11 @@ resulttuple_new_type(PyObject *self, PyObject *args) {
return NULL;
if (!PyList_Check (tuple_names)) {
- Py_DECREF (tuple_names);
PyErr_SetString (PyExc_TypeError, "not a list");
return NULL;
}
new_type = (PyObject *)pygi_resulttuple_new_type (tuple_names);
- Py_DECREF (tuple_names);
return new_type;
}
diff --git a/tests/test_resulttuple.py b/tests/test_resulttuple.py
index 1a4aadf9..45764952 100644
--- a/tests/test_resulttuple.py
+++ b/tests/test_resulttuple.py
@@ -37,8 +37,10 @@ class TestResultTuple(unittest.TestCase):
self.assertTrue(issubclass(ResultTuple, tuple))
def test_create(self):
- new = ResultTuple._new_type([None, "foo", None, "bar"])
- self.assertTrue(issubclass(new, ResultTuple))
+ names = [None, "foo", None, "bar"]
+ for i in range(10):
+ new = ResultTuple._new_type(names)
+ self.assertTrue(issubclass(new, ResultTuple))
def test_repr_dir(self):
new = ResultTuple._new_type([None, "foo", None, "bar"])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]