Skip to content

Commit 9d7d515

Browse files
authored
Merge pull request #3044 from HypothesisWorks/sobolevn-patch-1
Changes how we treat newtypes
2 parents 87f9f75 + 6b758e0 commit 9d7d515

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

hypothesis-python/RELEASE.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch fixes ``hypothesis.strategies._internal.types.is_a_new_type``.
4+
It was failing on Python ``3.10.0b4``, where ``NewType`` is a function.

hypothesis-python/src/hypothesis/strategies/_internal/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def try_issubclass(thing, superclass):
9898

9999

100100
def is_a_new_type(thing):
101-
if sys.version_info[:2] < (3, 10):
101+
if not isinstance(typing.NewType, type):
102102
# At runtime, `typing.NewType` returns an identity function rather
103103
# than an actual type, but we can check whether that thing matches.
104104
return (

0 commit comments

Comments
 (0)