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

Hypothesis error reporting triggering internal error in inspect module #3822

Open
DRMacIver opened this issue Dec 26, 2023 · 0 comments
Open
Assignees
Labels
bug something is clearly wrong here

Comments

@DRMacIver
Copy link
Member

DRMacIver commented Dec 26, 2023

Merry Christmas! I got you a really cursed looking bug.

In testing shrinkray I managed to trigger the following charming error:

Traceback (most recent call last):
(truncated pytest stuff) 

  File "/Users/drmaciver/Projects/shrink-ray/tests/test_generic_shrinking_properties.py", line 12, in test_can_shrink_arbitrary_problems
    initial=test_cases,
               ^^^
  File "/Users/drmaciver/Projects/shrink-ray/.venv/lib/python3.12/site-packages/hypothesis/core.py", line 1588, in wrapped_test
    raise the_error_hypothesis_found
  File "/Users/drmaciver/.pyenv/versions/3.12.0/lib/python3.12/inspect.py", line 1709, in getframeinfo
    start = lineno - 1 - context//2
            ~~~~~~~^~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

This only happens if verbosity is set to below verbose, suggesting it's occurring somewhere in how we trim stack traces.

I don't currently have a minimised reproducer for this (I'm aware of the irony), but if you check out https://github.com/DRMacIver/shrinkray/tree/DRMacIver/hypothesis-bug-repro, pip install -e .[dev] and run python -m pytest tests/test_generic_shrinking_properties.py, you'll get this error.

It's likely because I'm doing something slightly fishy with trying to recover from certain Hypothesis internal errors, but similar code (e.g. using st.functions slightly wrong here) also triggers this error.

I'll try to dig into it myself a bit later and provide a bit more of a usable bug report. Consider this more by way of IOU and/or if the problem is obvious to anyone else.

@DRMacIver DRMacIver changed the title Hypothesis error reporting triggering internal error in inspect library Hypothesis error reporting triggering internal error in inspect module Dec 26, 2023
@Zac-HD Zac-HD added the bug something is clearly wrong here label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here
Projects
None yet
Development

No branches or pull requests

2 participants