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

New failure on Python3.9 #12

Closed
sobolevn opened this issue Oct 27, 2020 · 11 comments
Closed

New failure on Python3.9 #12

sobolevn opened this issue Oct 27, 2020 · 11 comments

Comments

@sobolevn
Copy link

sobolevn commented Oct 27, 2020

Latest minimal example: compile('A.\u018a\\ ', '<string>', 'single')


Hi! We are using hypothesmith to test our wemake-python-styleguide linter.
And today I got this failure:

self = <hypothesmith.syntactic.GrammarStrategy object at 0x7f702a236ee0>
data = ConjectureData(VALID, 1628 bytes, frozen)
symbol = NonTerminal('simple_stmt')
draw_state = DrawState(result=['\r\n \t\t\t \t \t\n #²\x97\x9c\n\t\r\n \t \t#\U000cf1a7`\x1e£Í\x0b#Ã\U0009460b\U00041f90\U000b0ffc§...b6¯\n#r×í@d¿\x08\r\n  \t\t\t\t\t\t \t\t\t  \t\t \t\t\t\t#\U000dca7e\U000cad5c?\U0005caae¤ÂÁ0Z\U000aa6eap#\U0010c8a6{'])

    def draw_symbol(self, data, symbol, draw_state):  # type: ignore
        count = len(draw_state.result)
        super().draw_symbol(data, symbol, draw_state)
        if symbol.name in COMPILE_MODES:
            try:
                compile(
                    source="".join(draw_state.result[count:]),
                    filename="<string>",
                    mode=COMPILE_MODES[symbol.name],
                )
            except SystemError as err:  # pragma: no cover
                # Extra output to help track down a possible upstream issue
                # https://github.com/Zac-HD/stdlib-property-tests/issues/14
                source_code = "".join(draw_state.result[count:])
>               raise Exception(
                    "unexpected error while attempting to compile "
                    f"{ascii(source_code)!r} in mode={COMPILE_MODES[symbol.name]}"
                ) from err
E               Exception: unexpected error while attempting to compile "'import\\u012c\\u0155u\\u011f\\u9782\\u0117\\xc4\\xd8.\\xcd\\u0179\\u0152\\u0139\\u010b\\xdb.\\xd0\\U0002852aD\\u017b\\xd6\\\\\\t \\t\\r\\nas#\\U0009a4a1\\u0178T\\u5408\\U00029fe8\\xcb\\u0141\\U0002b2b9\\u013c\\xf34D\\xd1p\\xf1\\t\\x0c \\x0c\\x0c \\x0c\\t\\x0c \\x0c\\t \\x0c\\x0c\\x0c \\\\\\x0c\\t\\n;pass\\r\\n\\t \\t\\t  \\r\\n\\r\\n\\t\\t\\t \\t\\t#\\x8b\\n\\r\\n  \\t\\t#\\xe6k\\x81E\\r\\n\\t  \\t \\t#\\U0001ed6b\\xd1#^\\r\\n \\r\\n  \\t\\r\\n  \\t\\t\\t #G\\x08\\x08#\\xe3^6\\xf1\\x87\\U000d8254\\U00070572 oQ}\\x10\\xce\\xc1\\U000563b6\\xaf\\n#r\\xd7\\xed@d\\xbf\\x08\\r\\n  \\t\\t\\t\\t\\t\\t \\t\\t\\t  \\t\\t \\t\\t\\t\\t#\\U000dca7e\\U000cad5c?\\U0005caae\\xa4\\xc2\\xc10Z\\U000aa6eap#\\U0010c8a6{'" in mode=single

.venv/lib/python3.9/site-packages/hypothesmith/syntactic.py:119: Exception
---------------------------------- Hypothesis ----------------------------------
You can add @seed(11935010665446469984514748066733166299) to this test or run pytest with --hypothesis-seed=11935010665446469984514748066733166299 to reproduce this failure.

Test file: https://github.com/wemake-services/wemake-python-styleguide/blob/master/tests/test_checker/test_hypothesis.py
Version used: 0.1.5

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 28, 2020

Do you have the whole traceback? Even knowing what this exception was raised from would be very helpful!

@sobolevn
Copy link
Author

Nope, that's it 😢

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 28, 2020

Well, hopefully next time we'll have HypothesisWorks/hypothesis#2652 to help out!

@sobolevn
Copy link
Author

It works locally, btw:

» poetry run pytest tests/test_checker/test_hypothesis.py --hypothesis-seed=11935010665446469984514748066733166299
================================ test session starts =================================
platform darwin -- Python 3.9.0, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
Using --randomly-seed=3970102508
rootdir: /Users/sobolev/Documents/github/wemake-python-styleguide, configfile: setup.cfg
plugins: hypothesis-5.38.1, randomly-3.4.1, snapshottest-0.6.0, cov-2.10.1
collected 1 item                                                                     

tests/test_checker/test_hypothesis.py .     

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 28, 2020

Yeah, I couldn't reproduce it either 😭

(not the first really tricky issue Hypothesmith has found, either... Unicode makes parsing hard!)

@sobolevn
Copy link
Author

Shall I close it?

@sobolevn
Copy link
Author

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 30, 2020

That link goes to a passing build for me, without the check_run_id part 😕

@sobolevn
Copy link
Author

Sorry! It was rebased and the link has changed. Direct link: https://github.com/wemake-services/wemake-python-styleguide/runs/1332703481?check_suite_focus=true

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 31, 2020

No worries! I can definitely reproduce that, and even managed to reduce it a little further by hand. I've opened https://bugs.python.org/issue42218 but don't have any further advice beyond "consider skipping this on Python 3.9 for now" 😕

@Zac-HD Zac-HD closed this as completed Oct 31, 2020
@Zac-HD
Copy link
Owner

Zac-HD commented Oct 31, 2020

Upstream fix is python/cpython#23058 🥰

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