Message245333
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 |
|
Date |
User |
Action |
Args |
2015-06-14 03:33:14 | gumblex | set | recipients:
+ gumblex |
2015-06-14 03:33:14 | gumblex | set | messageid: <1434252794.24.0.0112893923697.issue24447@psf.upfronthosting.co.za> |
2015-06-14 03:33:14 | gumblex | link | issue24447 messages |
2015-06-14 03:33:13 | gumblex | create | |
|