{{ message }}
Repository navigation
Conversation
sobolevn
reviewed
Sep 24, 2025
Member
There was a problem hiding this comment.
The question is: does this function actually return None? Or is it a repr bug?
Author
There was a problem hiding this comment.
weirder and weirder
>>> from hypothesis.internal.lambda_sources import lambda_description
>>> lambda_description(lambda *args, **kwargs: None)
'lambda *args, **kwargs: None'
>>> lambda_description(lambda *args: None)
'lambda *args: <unknown>'
>>> lambda_description(lambda: None)
'lambda: <unknown>'I keep looking
Contributor
There was a problem hiding this comment.
Looks like the repr of lambdas was changed in HypothesisWorks/hypothesis#4500. Afaics, they used to always use <unknown>, but now they refine the lambda body string where possible. I think this should be a harmless change for us.
(Found this via the changelog for 6.137.3
This patch makes the stringification of lambdas, and as a result
certain automatic filter rewriting operations, more robust. This fixes
issue https://github.com/HypothesisWorks/hypothesis/issues/4498, where a lambda was mistakenly identified as the identity
operator due to "inspect.getsource()" only returning the first line of
the lambda definition.
As a result, the "repr" of strategies filtered or mapped by lambda
functions may change slightly.
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I have made things!
@pradeep90 hey! Your code is broken :) Can you validate it?
In hypothesis==6.137.2, this code produced the following output:
Whereas in hypothesis==6.140.2, the output is already:
So this is indeed a direct change in the library itself.
Checklist
CHANGELOG.mdRelated issues
Refs #2262
🙏 Please, if you or your company finds
dry-pythonvaluable, help us sustain the project by sponsoring it transparently on https://github.com/sponsors/dry-python. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.