where is the PyString_AsString in Python 3.0?

Benjamin Peterson benjamin at python.org
Sat Mar 7 04:55:56 CET 2009


BigHand <heweiwei <at> gmail.com> writes:
> 
> Finally I got the results now. This did take me 10 hours to solve
> this. the docs of 3.0......
> I hope this could help someone else:

> const char *strExcType =  PyBytes_AS_STRING(pyStr);
> Py_XDECREF(str_exc_type);
> Py_XDECREF(pyStr);

You can't Py_DECREF() pyStr while holding on to strExcType because
PyBytes_AS_STRING just yields a reference to the internal contents of the object.





More information about the Python-list mailing list