merge 3.1 (#14509)
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 62ddf21..796e400 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -875,7 +875,9 @@
     register unsigned char *p;
     register Py_hash_t x;
 
+#ifdef Py_DEBUG
     assert(_Py_HashSecret_Initialized);
+#endif
     if (a->ob_shash != -1)
         return a->ob_shash;
     len = Py_SIZE(a);
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a5ffc56..cd17789 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7673,7 +7673,9 @@
     Py_UNICODE *p;
     Py_hash_t x;
 
+#ifdef Py_DEBUG
     assert(_Py_HashSecret_Initialized);
+#endif
     if (self->hash != -1)
         return self->hash;
     len = Py_SIZE(self);