summaryrefslogtreecommitdiffstats
path: root/Modules/_sre/sre_lib.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-08 15:00:39 (GMT)
committerGitHub <noreply@github.com>2023-07-08 15:00:39 (GMT)
commitb305c69d1085c9e6c6875559109f73b827cb6fe0 (patch)
treea3f438aacac5524477620e00dd6d5499ff842a54 /Modules/_sre/sre_lib.h
parent74ec02e9490d8aa086aa9ad9d1d34d2ad999b5af (diff)
downloadcpython-b305c69d1085c9e6c6875559109f73b827cb6fe0.zip
cpython-b305c69d1085c9e6c6875559109f73b827cb6fe0.tar.gz
cpython-b305c69d1085c9e6c6875559109f73b827cb6fe0.tar.bz2
gh-106508: Improve debugging of the _sre module (GH-106509)
Now the VERBOSE macro can control tracing on per-pattern basis: * 0 -- disabled * 1 -- only if the DEBUG flag set * 2 -- always
Diffstat (limited to 'Modules/_sre/sre_lib.h')
-rw-r--r--Modules/_sre/sre_lib.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_sre/sre_lib.h b/Modules/_sre/sre_lib.h
index fb4c18b..c1a774f 100644
--- a/Modules/_sre/sre_lib.h
+++ b/Modules/_sre/sre_lib.h
@@ -209,6 +209,7 @@ SRE(count)(SRE_STATE* state, const SRE_CODE* pattern, Py_ssize_t maxcount)
const SRE_CHAR* ptr = (const SRE_CHAR *)state->ptr;
const SRE_CHAR* end = (const SRE_CHAR *)state->end;
Py_ssize_t i;
+ INIT_TRACE(state);
/* adjust end */
if (maxcount < end - ptr && maxcount != SRE_MAXREPEAT)
@@ -567,6 +568,7 @@ SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel)
SRE(match_context)* ctx;
SRE(match_context)* nextctx;
+ INIT_TRACE(state);
TRACE(("|%p|%p|ENTER\n", pattern, state->ptr));
@@ -1639,6 +1641,7 @@ SRE(search)(SRE_STATE* state, SRE_CODE* pattern)
SRE_CODE* charset = NULL;
SRE_CODE* overlap = NULL;
int flags = 0;
+ INIT_TRACE(state);
if (ptr > end)
return 0;