New submission from Serhiy Storchaka: In Python 2 string literals are allowed to contain non-ascii characters. In Python 3 bytes literals can contains only ascii characters, non-ascii characters should be escaped with \xXX. However 2to3 doesn't change b'...' literals and produces illegal code.
I propose new fixer which escapes non-ascii bytes in bytes literals. Here is a patch (without tests yet). ---------- components: 2to3 (2.x to 3.x conversion tool) files: 2to3_nonascii_bytes.patch keywords: patch messages: 197205 nosy: serhiy.storchaka, vinay.sajip priority: normal severity: normal stage: patch review status: open title: 2to3 can produce illegal bytes literals type: behavior versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file31657/2to3_nonascii_bytes.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18965> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com