diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-29 19:49:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-29 19:49:23 (GMT) |
commit | 9baa5b2de2e1bd4d56791de8144f737f65b89c74 (patch) | |
tree | 59cff121a4d2becfe389a825f1e2b66e8a839c45 /Modules/sre.h | |
parent | c31e6227f94c2bb0290336c739873173672a8991 (diff) | |
download | cpython-9baa5b2de2e1bd4d56791de8144f737f65b89c74.zip cpython-9baa5b2de2e1bd4d56791de8144f737f65b89c74.tar.gz cpython-9baa5b2de2e1bd4d56791de8144f737f65b89c74.tar.bz2 |
Issue #22437: Number of capturing groups in regular expression is no longer
limited by 100.
Diffstat (limited to 'Modules/sre.h')
-rw-r--r-- | Modules/sre.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/sre.h b/Modules/sre.h index 42fe28d..35d198f 100644 --- a/Modules/sre.h +++ b/Modules/sre.h @@ -18,8 +18,10 @@ #define SRE_CODE Py_UCS4 #if SIZEOF_SIZE_T > 4 # define SRE_MAXREPEAT (~(SRE_CODE)0) +# define SRE_MAXGROUPS ((~(SRE_CODE)0) / 2) #else # define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX) +# define SRE_MAXGROUPS ((SRE_CODE)PY_SSIZE_T_MAX / SIZEOF_SIZE_T / 2) #endif typedef struct { @@ -52,9 +54,6 @@ typedef struct { typedef unsigned int (*SRE_TOLOWER_HOOK)(unsigned int ch); -/* FIXME: <fl> shouldn't be a constant, really... */ -#define SRE_MARK_SIZE 200 - typedef struct SRE_REPEAT_T { Py_ssize_t count; SRE_CODE* pattern; /* points to REPEAT operator arguments */ @@ -76,7 +75,7 @@ typedef struct { /* registers */ Py_ssize_t lastindex; Py_ssize_t lastmark; - void* mark[SRE_MARK_SIZE]; + void** mark; /* dynamically allocated stuff */ char* data_stack; size_t data_stack_size; |