error converting list to tuple
Stefan Seefeld
seefeld at sympatico.ca
Tue May 18 13:05:24 EDT 2004
Terry Reedy wrote:
> "Stefan Seefeld" <seefeld at sympatico.ca> wrote in message
>>(I call this code from within a C++ extension module),
>
>
> You should have said that in the beginning since that is a whole different
> ball game: extension modules in C are not Python.
ok, let me be more specific: From my C++ code I call a method
of a python object which happens to do the tuple->list conversion.
And as Python is implemented in C, I thought it didn't matter,
it's the same underlying API / object model, just different syntax ;-)
> It is easy to mess up in C ;-). You are most likely to get an answer (from
> another C extension writer) if you post a short as possible code snippet
> that exhibits the error, and the actual and complete error message.
That's (part of) the problem: I can't reproduce this in isolation,
so I wanted to know how I could debug this.
What I do is calling 'PyObject_Str' on the python object. That object
has its '__str__' method implemented in a way that involves said
tuple->list conversion, so the call raises an exception and
the call returns 0.
Thanks,
Stefan
More information about the Python-list
mailing list