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

W605: identical tokens cause infinite loop #449

Closed
bigredengineer opened this issue Oct 31, 2018 · 4 comments
Closed

W605: identical tokens cause infinite loop #449

bigredengineer opened this issue Oct 31, 2018 · 4 comments
Milestone

Comments

@bigredengineer
Copy link
Contributor

There is a bug with the way that tokens are handled with W605 that causes an infinite loop to occur when two identical W605 tokens exist on the same line of code. This infinite loop can be observed both on the command line and by adding a test to the test_autopep8.py unit test file.

Test Case Code:
escape = foo('\.bar', '\.bar')\n

Command Line:
autopep8.py src/ -i -r --exclude "config_*" -a -j 8

Workaround:

  • To the command line, add --pep8-passes <n>. This will break the infinite loop, but a bad code-fix is put in place
  • Bad Code-Fix Example = escape = foo(rrrrrrrrr'\.bar', '\.bar')\n

Version Info
autopep8.py --version : autopep8 1.4.1 (pycodestyle: 2.4.0)
/usr/bin/env python --version : Python 2.7.5

@hhatto
Copy link
Owner

hhatto commented Nov 2, 2018

planning to release version 1.4.3.

@hhatto
Copy link
Owner

hhatto commented Nov 12, 2018

version 1.4.3 released
https://pypi.org/project/autopep8/1.4.3/

@stmlange
Copy link

This still seems to be an issue again with 1.4.4:

$ python -m autopep8 --version
autopep8 1.4.4 (pycodestyle: 2.5.0)

$ cat << EOF > foo.py                                                   
import re
re.findall(rr'([0-9]+)([^\s]+)', "122122aaaaaa")
EOF

$ python -m autopep8 -i --ignore errors=E401,E402 -aaa --verbose foo.py

@hhatto hhatto reopened this Sep 25, 2019
@hhatto hhatto added this to the 1.5 milestone Dec 16, 2019
@hhatto
Copy link
Owner

hhatto commented Dec 16, 2019

fix in #514 .

planning to release version 1.5.

Thanks

@hhatto hhatto closed this as completed Dec 16, 2019
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

3 participants