diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-09 01:17:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 01:17:31 +0100 |
commit | 58bafe42ab161473ba36c9231c3bf2e64ac8db82 (patch) | |
tree | a482212bcff5e4e6b2f0a50021cab6c08905e0a7 /Tools | |
parent | bpo-43774: Enhance configure documentation (GH-25293) (diff) | |
download | cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.tar.gz cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.tar.bz2 cpython-58bafe42ab161473ba36c9231c3bf2e64ac8db82.zip |
Sanitize macros and debug functions in pegen.c (GH-25291)
Diffstat (limited to 'Tools')
-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 94e729e56d9..bb4c1b0178c 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; } |