Skip to content

Conversation

@Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Jan 10, 2026

Closes #4638

@Zac-HD Zac-HD requested a review from Liam-DeVoe as a code owner January 10, 2026 21:14
@Zac-HD Zac-HD force-pushed the fix-recursive-strategy branch 2 times, most recently from 43ab06c to 82b5302 Compare January 10, 2026 22:15
@Zac-HD Zac-HD force-pushed the fix-recursive-strategy branch 2 times, most recently from 2e2f484 to d6911d5 Compare January 10, 2026 22:46
@Zac-HD Zac-HD force-pushed the fix-recursive-strategy branch from d6911d5 to 2b6c06f Compare January 11, 2026 00:16
@Zac-HD Zac-HD enabled auto-merge January 11, 2026 00:50
@Liam-DeVoe
Copy link
Member

Liam-DeVoe commented Jan 12, 2026

Noting that there are (very contrived, surely) ways to defeat is_first_param_referenced_in_function:

>>> from hypothesis import strategies as st
>>> st.recursive(st.none(), lambda x: st.lists(locals()['x'])).example()
/Users/tybug/Desktop/Liam/coding/hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py:508: HypothesisDeprecationWarning: extend=lambda x: <unknown> doesn't use it's argument, and thus can't actually recurse!
  self.do_validate()
[[None], [None, None, None, None, None, None, None, None, None], [], None]
>>> 

which means I'd lean towards making this a warning, which can be suppressed if we get it wrong, rather than an error after the deprecation period.

(Same applies for the draw-not-used warning for @st.composite).

@Liam-DeVoe Liam-DeVoe force-pushed the fix-recursive-strategy branch from 7658f1b to a0082e8 Compare January 12, 2026 06:52
@Zac-HD
Copy link
Member Author

Zac-HD commented Jan 12, 2026

"don't do that, then"

Copy link
Member

@Liam-DeVoe Liam-DeVoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but users will be rightfully annoyed that we presume to know better than them and they can't silence our opinions :)

To be clear I don't view this as blocking. I figured we'd disagree on this; and I still wanted to put my opinion on record here

status = f"{status} ({data.interesting_origin!r})"
elif data.status == Status.INVALID and isinstance(data, ConjectureData):
assert isinstance(data, ConjectureData) # mypy is silly
status = f"{status} ({data.events.get('invalid because', '?')})"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unknown might be more clear than ?, but I'll wait to see this in action to form a solid opinion

@Zac-HD Zac-HD merged commit 8cc1f38 into HypothesisWorks:master Jan 12, 2026
76 checks passed
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.

strategies.recursive() stops generating recursive structures in 6.150.0

2 participants