diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-09 00:17:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 00:17:31 (GMT) |
commit | 58bafe42ab161473ba36c9231c3bf2e64ac8db82 (patch) | |
tree | a482212bcff5e4e6b2f0a50021cab6c08905e0a7 /Tools/peg_generator | |
parent | 54366953633dbe5d9585dbae0c633d4e92df2d04 (diff) | |
download | cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.zip cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.tar.gz cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.tar.bz2 |
Sanitize macros and debug functions in pegen.c (GH-25291)
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; } |