[Python-Dev] Pep 393 and debugging

Kristján Valur Jónsson kristjan at ccpgames.com
Fri Apr 6 15:27:12 CEST 2012


I just had my first fun with Pep 393 strings and debuggers.  Trying to debug a deadlocked python program, I'm trying to figure out the callstack of the thread in the debugger.

I ended up with something like:



(char*)&((PyASCIIObject*)(tstate->frame->f_code->co_filename))[1]



while previously, it was sufficient to do

(PyUnicodeObject*)(tstate->frame->f_code->co_filename)



Obviously this won't work for non-ASCII objects.

I wonder if there is a way to make this situation easier?  Perhaps for "debug" builds, we can store some debug information in the frame object, e.g. utf8 encoding of the filename and function?



K




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120406/2d511d56/attachment.html>


More information about the Python-Dev mailing list