[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH pyblock] Fix Python object converter pyblock_TorLtoT



gcc pointed out that 'result' is set but never used, and this
has highlighted an oversight in how this Python object converter
function is written.

Fix it according to the Python documentation and using the implementation
of PyUnicode_FSConverter() as a point of reference.

Compile tested only.
---
 pyhelpers.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pyhelpers.c b/pyhelpers.c
index a050839..9e15ff3 100644
--- a/pyhelpers.c
+++ b/pyhelpers.c
@@ -157,7 +157,7 @@ pyblock_potoll(PyObject *obj, void *addr)
 int
 pyblock_TorLtoT(PyObject *obj, void *addr)
 {
-	PyObject *result = (PyObject *)addr;
+	PyObject **result = (PyObject **)addr;
 
 	if (!obj) {
 		if (!PyErr_Occurred())
@@ -166,16 +166,16 @@ pyblock_TorLtoT(PyObject *obj, void *addr)
 	}
 
 	if (PyTuple_Check(obj)) {
-		result = obj;
+		*result = obj;
 		return 1;
 	}
 
 	if (PyList_Check(obj)) {
-		result = PyList_AsTuple(obj);
+		*result = PyList_AsTuple(obj);
 		return 1;
 	}
 
-	result = NULL;
+	*result = NULL;
 	PyErr_BadArgument();
 	return 0;
 }
-- 
1.7.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]