$OpenBSD: patch-src_hypothesis_internal_compat_py,v 1.1 2020/01/03 14:51:21 sthen Exp $

From 1e9cf75dcc28c6b0c7c211a20e49257a4e052c84 Mon Sep 17 00:00:00 2001
From: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
Date: Fri, 21 Jun 2019 12:19:15 +1000
Subject: [PATCH] Support newer typing backport too

Index: src/hypothesis/internal/compat.py
--- src/hypothesis/internal/compat.py.orig
+++ src/hypothesis/internal/compat.py
@@ -298,10 +298,13 @@ except ImportError:
     typing_root_type = ()  # type: Tuple[type, ...]
     ForwardRef = None
 else:
-    if hasattr(typing, "_Final"):  # new in Python 3.7
+    try:
+        # These types are new in Python 3.7, but also (partially) backported to the
+        # typing backport on PyPI.  Use if possible; or fall back to older names.
+
         typing_root_type = (typing._Final, typing._GenericAlias)  # type: ignore
         ForwardRef = typing.ForwardRef  # type: ignore
-    else:
+    except AttributeError:
         typing_root_type = (typing.TypingMeta, typing.TypeVar)  # type: ignore
         ForwardRef = typing._ForwardRef  # type: ignore
 
