Skip to content

Error in ast.unparse on nightly CPython #14

Closed

Description

@Zac-HD

Via #13, we found https://travis-ci.com/github/Zac-HD/stdlib-property-tests/jobs/335728827#L232-L259

ERROR: test_ast_unparse (test_source_code.TestAST)
Unparsing always produces code which parses back to the same ast.
----------------------------------------------------------------------
  File "<string>", line 1
SyntaxError: unexpected character after line continuation character
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/travis/build/Zac-HD/stdlib-property-tests/tests/test_source_code.py", line 20, in test_ast_unparse
    @given(source_code=hypothesmith.from_grammar())
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesis/core.py", line 1102, in wrapped_test
    raise the_error_hypothesis_found
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesmith/syntactic.py", line 86, in draw_symbol
    super().draw_symbol(data, symbol, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesis/extra/lark.py", line 175, in draw_symbol
    self.draw_symbol(data, e, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesmith/syntactic.py", line 86, in draw_symbol
    super().draw_symbol(data, symbol, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesis/extra/lark.py", line 175, in draw_symbol
    self.draw_symbol(data, e, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesmith/syntactic.py", line 86, in draw_symbol
    super().draw_symbol(data, symbol, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesis/extra/lark.py", line 175, in draw_symbol
    self.draw_symbol(data, e, draw_state)
  File "/home/travis/build/Zac-HD/stdlib-property-tests/.tox/test/lib/python3.9/site-packages/hypothesmith/syntactic.py", line 89, in draw_symbol
    compile(
SystemError: <built-in function normalize> returned a result with an error set

Maybe @pganssle has some idea what's happening here?

Activity

  1. pganssle commented on May 17, 2020

    @pganssle
    Collaborator

    @Zac-HD Looks to me like an uncaught error in the C code in CPython, but because the error appears to be in hypothesmith, I can't tell what the reproducing case is. I assume it's an error in CPython, possibly related to the new parser. Do you know how to get a more minimal reproducing case? I'm assuming there's a specific input to compile that would trigger this.

  2. Zac-HD commented on May 17, 2020

    @Zac-HD
    OwnerAuthor

    ...I think the easiest way to get some output might be to add a special print-this-on-error case to Hypothesmith, I don't have a CPython nightly handy but releasing a new library version is faster anyway 😂

  3. Zac-HD commented on May 17, 2020

    @Zac-HD
    OwnerAuthor
    nonlocal𖫬𣩑盙Ѵ𘧮	 	 ;from. 		 import퇉as\		
    辚𦱁𘟂痪 ,;global𬪻𓁤㘍𛊤𦡧𦜕𦑚𤆶,   𠶰ꩀ𭋿
    		 	

    is I think a reproducing case, if it printed properly and survived from travis.

    If not, the latest version of Hypothesmith should now raise a more useful error, and if that fails too I'll need to finish rebuilding my desktop, get a proper dev environment set up, and hack on this properly.

  4. pganssle commented on May 17, 2020

    @pganssle
    Collaborator
  5. Zac-HD commented on May 18, 2020

    @Zac-HD
    OwnerAuthor

    Also got this error, unexpected error while attempting to compile 'import𤂴洍𗩺ꐥ𫅦隐𫢯.𣲕䧮럛𐪏𣕹𮡝.㙏𝗫𛅿𡩸𮘿𫶦\\\x0c\x0c\x0c\x0c \x0c \x0c\t\x0c\t \x0c\r\n\r\n' in mode=single

  6. Zac-HD commented on Jun 6, 2020

    @Zac-HD
    OwnerAuthor

    Pretty sure this has been fixed upstream now 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions