From d0f4e073883f420c4c622c2b547f21bd4dc5f596 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 6 Oct 2024 13:04:07 -0500 Subject: [PATCH] Fix importing the C extensions on Python 3.8 (#26) --- CHANGES/26.bugfix.rst | 1 + src/propcache/_helpers_c.pyx | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 CHANGES/26.bugfix.rst diff --git a/CHANGES/26.bugfix.rst b/CHANGES/26.bugfix.rst new file mode 100644 index 0000000..4f6c208 --- /dev/null +++ b/CHANGES/26.bugfix.rst @@ -0,0 +1 @@ +Fixed loading the C-extensions on Python 3.8 -- by :user:`bdraco`. diff --git a/src/propcache/_helpers_c.pyx b/src/propcache/_helpers_c.pyx index 5369e12..3999a67 100644 --- a/src/propcache/_helpers_c.pyx +++ b/src/propcache/_helpers_c.pyx @@ -1,5 +1,13 @@ # cython: language_level=3 -from types import GenericAlias +import sys +import types + +if sys.version_info >= (3, 9): + GenericAlias = types.GenericAlias +else: + + def GenericAlias(cls): + return cls cdef _sentinel = object()