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

Handle ValueError from check_syntax #386

Merged
merged 1 commit into from
Mar 30, 2018
Merged

Handle ValueError from check_syntax #386

merged 1 commit into from
Mar 30, 2018

Conversation

Hnasar
Copy link
Contributor

@Hnasar Hnasar commented Mar 14, 2018

UnicodeDecodeError is a subclass of ValueError

Fixes:
...
File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 1390, in fix_e265
include_docstrings=True) | set(commented_out_code_lines(source))
File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 3010, in commented_out_code_lines
check_syntax(stripped_line)
File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 2889, in check_syntax
return compile(code, '', 'exec', dont_inherit=True)
ValueError: invalid \x escape

When run on a file with:

"\xhh" \

UnicodeDecodeError is a subclass of ValueError

Fixes:
  ...
  File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 1390, in fix_e265
    include_docstrings=True) | set(commented_out_code_lines(source))
  File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 3010, in commented_out_code_lines
    check_syntax(stripped_line)
  File "/home/hashem/pyve2/local/lib/python2.7/site-packages/autopep8.py", line 2889, in check_syntax
    return compile(code, '<string>', 'exec', dont_inherit=True)
ValueError: invalid \x escape

When run on a file with:

 # "\xhh" \
@hhatto hhatto merged commit 07ae5da into hhatto:master Mar 30, 2018
@hhatto
Copy link
Owner

hhatto commented Mar 30, 2018

@Hnasar
good catch.
Thanks!!

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

Successfully merging this pull request may close these issues.

2 participants