[issue12930] reindent.py inserts spaces in multiline literals

2011-12-31 Thread Jonathan Rogers

Jonathan Rogers  added the comment:

I don't think reindent.py should change any bytes inside string literals since 
it can't know anything about what those strings mean or how they'll be used by 
the program at run time. Unfortunately, it starts out by unconditionally 
calling the .expandtabs() method on each input line, so tab characters are 
lost. The only change to a string literal I can imagine that would be safe is 
to replace tab characters with '\t'.

I am trying to use reindent.py on Python source files which include 
triple-quoted, multi-line string literals containing makefile and Python 
snippets. In both cases, running reindent.py changes the meaning of of that 
contained in the literal.

--
nosy: +Jonathan.Rogers

___
Python tracker 
<http://bugs.python.org/issue12930>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12930] reindent.py inserts spaces in multiline literals

2011-12-31 Thread Jonathan Rogers

Jonathan Rogers  added the comment:

Rather than expanding tab characters inside string literals, it's safer to 
replace them with '\t'.

--
Added file: http://bugs.python.org/file24120/save_strings.patch

___
Python tracker 
<http://bugs.python.org/issue12930>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com