New submission from Dingyuan Wang: If a script uses tabs for indentation, tokenize.untokenize won't restore original indentation correctly from the second line of the indentation level, and thus breaks the file.
This affects all Python versions. Test code: python2 -c 'import sys, tokenize; sys.stdout.write(tokenize.untokenize(tokenize.generate_tokens(sys.stdin.readline)))' < tab.py python3 -c 'import sys, tokenize; sys.stdout.buffer.write(tokenize.untokenize(tokenize.tokenize(sys.stdin.buffer.readline)))' < tab.py Out: def foo(): pass pass if 1: pass pass ---------- components: Library (Lib) files: tab.py messages: 245333 nosy: gumblex priority: normal severity: normal status: open title: tab indentation breaks in tokenize.untokenize type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file39704/tab.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24447> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com