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

astor 0.8 - Test failures under Python 3.7.3 #146

Open
felixonmars opened this issue May 31, 2019 · 3 comments
Open

astor 0.8 - Test failures under Python 3.7.3 #146

felixonmars opened this issue May 31, 2019 · 3 comments
Labels

Comments

@felixonmars
Copy link
Contributor

root: WARNING:
Files not processed due to syntax errors:
root: WARNING:     /usr/lib/python3.7/lib2to3/tests/data/bom.py
root: WARNING:     /usr/lib/python3.7/lib2to3/tests/data/crlf.py
root: WARNING:     /usr/lib/python3.7/lib2to3/tests/data/different_encoding.py
root: WARNING:     /usr/lib/python3.7/lib2to3/tests/data/false_encoding.py
root: WARNING:     /usr/lib/python3.7/lib2to3/tests/data/py2_test_grammar.py
root: WARNING:     /usr/lib/python3.7/test/bad_coding.py
root: WARNING:     /usr/lib/python3.7/test/bad_coding2.py
root: WARNING:     /usr/lib/python3.7/test/badsyntax_3131.py
root: WARNING:     /usr/lib/python3.7/test/badsyntax_pep3120.py
root: WARNING:
Files failed to round-trip to AST:
root: WARNING:     /usr/lib/python3.7/test/test_fstring.py

Turns out python's fstring test still failed to round trip after the fstring fixes.

@felixonmars
Copy link
Contributor Author

The generated test_fstring.py became SyntaxError:

  File "test_fstring.py", line 534
    self.assertEqual(f'{"eric\'s"}', "eric's")
                    ^
SyntaxError: f-string expression part cannot include a backslash

The correct source is:

self.assertEqual(f"{'''eric's'''}", "eric's")

Generated srcdmp seems to be correct:

                        Expr(
                            value=Call(func=Attribute(value=Name(id='self'), attr='assertEqual'),
                                args=[
                                    JoinedStr(
                                        values=[FormattedValue(value=Str(s="eric's"), conversion=-1, format_spec=None)]),
                                    Str(s="eric's")],
                                keywords=[])),

@berkerpeksag
Copy link
Owner

Thanks for the report. This looks like the same case as reported at https://bugs.python.org/issue28002#msg341512.

@berkerpeksag
Copy link
Owner

python/cpython@a993e90 can be used as a starting point to fix this.

@berkerpeksag berkerpeksag mentioned this issue Jan 1, 2025
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants