Closed as not planned
Description
Bug report
Bug description:
Tab characters used as white space do not roundtrip when using untokenize
. Here's an example:
import tokenize, io
source = "a +\tb"
tokens = list(tokenize.generate_tokens(io.StringIO(source).readline))
x = tokenize.untokenize(tokens)
print(x)
# a + b
Here, the tab is replaced with a regular space. Given that untokenize tries to match the source string exactly, I think we should fix this. We can do that by getting the characters from the source line rather than always using a normal space:
Line 185 in 9c2bb7d
I'll send a fix in a moment :)
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux