Re: Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread skip
MRAB> Should you be using "char *" when they aren't char? Is there a MRAB> wide char type of some sort? No, I shouldn't. The storage is wchar_t *, what you get with my first printed expression: (gdb) set $__f = (PyUnicodeObject *)(co->co_filename) (gdb) p *$__f->s...@$__f->length

Re: Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread MRAB
s...@pobox.com wrote: I'm trying to convert Python's gdbinit file to Python 3. One of the things it does is print filenames and function names when displaying stack frames. This worked fine in Python 2 because the type of such objects is PyStringObject which uses NUL-terminated strings under the

Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread skip
I'm trying to convert Python's gdbinit file to Python 3. One of the things it does is print filenames and function names when displaying stack frames. This worked fine in Python 2 because the type of such objects is PyStringObject which uses NUL-terminated strings under the covers. For example: