[Numpy-discussion] Segfault with python 3.2 structured array non-existent field

Matthew Brett matthew.brett at gmail.com
Tue Mar 15 14:16:49 EDT 2011


On Tue, Mar 15, 2011 at 11:07 AM, Pauli Virtanen <pav at iki.fi> wrote:
> Tue, 15 Mar 2011 10:23:35 -0700, Matthew Brett wrote:
> [clip]
>> OK - I realize I'm being very lazy here but, do you mean:
>>         PyErr_Format(PyExc_ValueError,
>>>>                      "field named %s not found.",
>>>>                      PyString_AsString(PyObject_Repr(index)));
>>> The PyString_AsString is present, as it's mapped on Py3 to
>>> PyBytes_AsString by "npy_3kcompat.h".
>> Oh - dear - I think I felt a blood vessel pop somewhere in my brain :)
> This was an "answer" to your question as I understood it:
> "PyString_AsString is no longer a part of the API on Python 3.x. So how
> come this code can work on Python 3 if it appears here?"

Oh - dear - again.  Yes it was a helpful answer and direct to my
question - implication otherwise entirely accidental.  The blood
vessel was only because my brain was already twisted from trying to
unlearn the correspondence between string and byte in python 3...

I fear that my suggestion as to what you meant by repr doesn't make
sense though.

See you,


More information about the NumPy-Discussion mailing list