diff options
Diffstat (limited to 'Tools/peg_generator')
-rw-r--r-- | Tools/peg_generator/peg_extension/peg_extension.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Tools/peg_generator/peg_extension/peg_extension.c b/Tools/peg_generator/peg_extension/peg_extension.c index 94e729e..bb4c1b0 100644 --- a/Tools/peg_generator/peg_extension/peg_extension.c +++ b/Tools/peg_generator/peg_extension/peg_extension.c @@ -109,20 +109,27 @@ error: static PyObject * clear_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored)) { +#if defined(PY_DEBUG) _PyPegen_clear_memo_statistics(); +#endif Py_RETURN_NONE; } static PyObject * get_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored)) { +#if defined(PY_DEBUG) return _PyPegen_get_memo_statistics(); +#else + Py_RETURN_NONE; +#endif } // TODO: Write to Python's sys.stdout instead of C's stdout. static PyObject * dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored)) { +#if defined(PY_DEBUG) PyObject *list = _PyPegen_get_memo_statistics(); if (list == NULL) { return NULL; @@ -139,6 +146,7 @@ dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored)) } } Py_DECREF(list); +#endif Py_RETURN_NONE; } |