Terry J. Reedy <tjre...@udel.edu> added the comment: Pardon my ignorance, but given that code.co_filename is a string attribute given as a string, which is to say, unicode in 3.x, I do not see what filesystem encodings, or any other encoding to bytes should really have to do with the attribute. I actually would have expected compile to take your example argument 'abc\uDC80' and paste it onto the code object unchanged. The only issue to me is whether any string should be allowed or only legal-unicode strings. Anything else would seem like a 2.x holdover.
If PyBytes_AS_STRING (macro version of PyBytes_AsString) is the implementation of str(bytes_object) (as I would guess from the doc), then as I read your patch, it will produce rather strange 'filenames'. >>> str('abc\uDC80'.encode("utf-8", "surrogateescape")) "b'abc\\x80'" always wrapped in b'...'. If not that, what does it do (with no decoding specified)? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10114> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com