Sanitize macros and debug functions in pegen.c (GH-25291)

diff --git a/Parser/pegen.c b/Parser/pegen.c
index 729b747..0aa55cf 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -725,6 +725,8 @@
     return 0;
 }
 
+
+#if defined(Py_DEBUG)
 // Instrumentation to count the effectiveness of memoization.
 // The array counts the number of tokens skipped by memoization,
 // indexed by type.
@@ -761,6 +763,7 @@
     }
     return ret;
 }
+#endif
 
 int  // bool
 _PyPegen_is_memoized(Parser *p, int type, void *pres)
@@ -776,6 +779,7 @@
 
     for (Memo *m = t->memo; m != NULL; m = m->next) {
         if (m->type == type) {
+#if defined(PY_DEBUG)
             if (0 <= type && type < NSTATISTICS) {
                 long count = m->mark - p->mark;
                 // A memoized negative result counts for one.
@@ -784,6 +788,7 @@
                 }
                 memo_statistics[type] += count;
             }
+#endif
             p->mark = m->mark;
             *(void **)(pres) = m->node;
             return 1;
@@ -2286,9 +2291,9 @@
     }
 
 #define VISIT_CONTAINER(CONTAINER, TYPE) do { \
-        Py_ssize_t len = asdl_seq_LEN(CONTAINER->v.TYPE.elts);\
+        Py_ssize_t len = asdl_seq_LEN((CONTAINER)->v.TYPE.elts);\
         for (Py_ssize_t i = 0; i < len; i++) {\
-            expr_ty other = asdl_seq_GET(CONTAINER->v.TYPE.elts, i);\
+            expr_ty other = asdl_seq_GET((CONTAINER)->v.TYPE.elts, i);\
             expr_ty child = _PyPegen_get_invalid_target(other, targets_type);\
             if (child != NULL) {\
                 return child;\