Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly removes valid whitespace #322

Closed
benf-wspdigital opened this issue Apr 11, 2017 · 1 comment
Closed

Incorrectly removes valid whitespace #322

benf-wspdigital opened this issue Apr 11, 2017 · 1 comment

Comments

@benf-wspdigital
Copy link

benf-wspdigital commented Apr 11, 2017

The U+000C FORM FEED character is valid white space. A line containing only U+000C at the end of a line is a valid blank line for Python::

$ printf "print('hello')\n\f\nprint('python')\n" > foo.py

$ wc foo.py
       3       2      33 foo.py

$ pycodestyle foo.py

$ python3 ./foo.py
hello
python

The autopep8 behaviour removes the valid whitespace::

$ autopep8 foo.py > foo.py.autopep8

$ wc foo.py.autopep8 
       3       2      32 foo.py.autopep8

$ grep -c '\f$' foo.py foo.py.autopep8 
foo.py:1
foo.py.autopep8:0

The pycodestyle tool correctly does not consider the U+000C character a trailing white space character (the W291 warning is not triggered).

So the autopep8 tool should also not remove that valid character from the line.

hhatto pushed a commit that referenced this issue Jan 30, 2018
@hhatto
Copy link
Owner

hhatto commented Jan 30, 2018

@benf-wspdigital
Thanks for reporting 👍

fix in #376.

@hhatto hhatto closed this as completed Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants