Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian GCC (http://www.linux-archive.org/debian-gcc/)
-   -   Fix Python object converter pyblock_TorLtoT (http://www.linux-archive.org/debian-gcc/585470-fix-python-object-converter-pyblock_torltot.html)

Daniel Drake 10-09-2011 07:04 PM

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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 11:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.