Eryk Sun <eryk...@gmail.com> added the comment: If you're automatically wrapping a C source file and don't know the source encoding, you could naively decode it as Latin-1. You're still faced with the problem of characters that Python doesn't allow in identifiers. For example, gcc allows "$" in C identifiers (e.g. a field named "egg$"), but Python doesn't allow this character. At least you can use getattr() to access such names. For example:
>>> s = bytes(range(256)).decode('latin-1') >>> T = type('T', (), {s: 0}) >>> t = T() >>> getattr(t, s) 0 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33242> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com