Skip to content

Commit

Permalink
Merge pull request #3044 from HypothesisWorks/sobolevn-patch-1
Browse files Browse the repository at this point in the history
Changes how we treat newtypes
  • Loading branch information
Zac-HD authored Jul 27, 2021
2 parents 87f9f75 + 6b758e0 commit 9d7d515
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RELEASE_TYPE: patch

This patch fixes ``hypothesis.strategies._internal.types.is_a_new_type``.
It was failing on Python ``3.10.0b4``, where ``NewType`` is a function.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def try_issubclass(thing, superclass):


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

0 comments on commit 9d7d515

Please sign in to comment.