diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 7deaa22af146ac1d6cf6ae8f8813cfcb2908cc12..34e755e6d7d6c4809814b4b62272b2d0fdc6a9e0 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -431,7 +431,7 @@ class __Pyx_FakeReference {
 #endif
 
 // TSS (Thread Specific Storage) API
-#if PY_VERSION_HEX < 0x03070000 && !defined(PyThread_tss_create)
+#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
 #include "pythread.h"
 #define Py_tss_NEEDS_INIT 0
 typedef int Py_tss_t;