summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/_sre
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-02-03 21:59:07 +0300
committershadchin <[email protected]>2026-02-03 22:28:51 +0300
commitbce46f28de392862d5c6c3b185d844ee7c623be3 (patch)
tree424878b5b90144f98970ce4a2745990c77330ad2 /contrib/tools/python3/Modules/_sre
parent0e0ee9fa48ce9411b4038aa769493d22ff6c10a2 (diff)
Import Python 3.13.11
commit_hash:bbb53cefb159aa3e7afaa475fd19d5a03b66945f
Diffstat (limited to 'contrib/tools/python3/Modules/_sre')
-rw-r--r--contrib/tools/python3/Modules/_sre/clinic/sre.c.h21
-rw-r--r--contrib/tools/python3/Modules/_sre/sre.c151
-rw-r--r--contrib/tools/python3/Modules/_sre/sre.h1
-rw-r--r--contrib/tools/python3/Modules/_sre/sre_constants.h3
-rw-r--r--contrib/tools/python3/Modules/_sre/sre_lib.h46
5 files changed, 158 insertions, 64 deletions
diff --git a/contrib/tools/python3/Modules/_sre/clinic/sre.c.h b/contrib/tools/python3/Modules/_sre/clinic/sre.c.h
index 56a4e6048fa..6479990d1a4 100644
--- a/contrib/tools/python3/Modules/_sre/clinic/sre.c.h
+++ b/contrib/tools/python3/Modules/_sre/clinic/sre.c.h
@@ -3,10 +3,11 @@ preserve
[clinic start generated code]*/
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
-# include "pycore_gc.h" // PyGC_Head
-# include "pycore_runtime.h" // _Py_ID()
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
#endif
-
+#include "pycore_abstract.h" // _PyNumber_Index()
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(_sre_getcodesize__doc__,
"getcodesize($module, /)\n"
@@ -53,7 +54,7 @@ _sre_ascii_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
- character = _PyLong_AsInt(arg);
+ character = PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -85,7 +86,7 @@ _sre_unicode_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
- character = _PyLong_AsInt(arg);
+ character = PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -117,7 +118,7 @@ _sre_ascii_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
- character = _PyLong_AsInt(arg);
+ character = PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -149,7 +150,7 @@ _sre_unicode_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
- character = _PyLong_AsInt(arg);
+ character = PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1000,7 +1001,7 @@ _sre_SRE_Pattern__fail_after(PatternObject *self, PyObject *const *args, Py_ssiz
if (!_PyArg_CheckPositional("_fail_after", nargs, 2, 2)) {
goto exit;
}
- count = _PyLong_AsInt(args[0]);
+ count = PyLong_AsInt(args[0]);
if (count == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1069,7 +1070,7 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit;
}
pattern = args[0];
- flags = _PyLong_AsInt(args[1]);
+ flags = PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
@@ -1502,4 +1503,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const
#ifndef _SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF
#define _SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF
#endif /* !defined(_SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF) */
-/*[clinic end generated code: output=2165ecf43a7c20e8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=32f2528c7b5b6081 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_sre/sre.c b/contrib/tools/python3/Modules/_sre/sre.c
index 35c6058dac4..c0cc8268d2d 100644
--- a/contrib/tools/python3/Modules/_sre/sre.c
+++ b/contrib/tools/python3/Modules/_sre/sre.c
@@ -38,21 +38,56 @@
static const char copyright[] =
" SRE 2.2.2 Copyright (c) 1997-2002 by Secret Labs AB ";
-#define PY_SSIZE_T_CLEAN
-
#include "Python.h"
-#include "pycore_long.h" // _PyLong_GetZero()
-#include "pycore_moduleobject.h" // _PyModule_GetState()
-#include "structmember.h" // PyMemberDef
+#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION
+#include "pycore_dict.h" // _PyDict_Next()
+#include "pycore_long.h" // _PyLong_GetZero()
+#include "pycore_moduleobject.h" // _PyModule_GetState()
+#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
+
+#include "sre.h" // SRE_CODE
-#include "sre.h"
+#include <ctype.h> // tolower(), toupper(), isalnum()
#define SRE_CODE_BITS (8 * sizeof(SRE_CODE))
-#include <ctype.h>
+// On macOS, use the wide character ctype API using btowc()
+#if defined(__APPLE__)
+# define USE_CTYPE_WINT_T
+#endif
+
+static int sre_isalnum(unsigned int ch) {
+#ifdef USE_CTYPE_WINT_T
+ return (unsigned int)iswalnum(btowc((int)ch));
+#else
+ return (unsigned int)isalnum((int)ch);
+#endif
+}
+
+static unsigned int sre_tolower(unsigned int ch) {
+#ifdef USE_CTYPE_WINT_T
+ return (unsigned int)towlower(btowc((int)ch));
+#else
+ return (unsigned int)tolower((int)ch);
+#endif
+}
+
+static unsigned int sre_toupper(unsigned int ch) {
+#ifdef USE_CTYPE_WINT_T
+ return (unsigned int)towupper(btowc((int)ch));
+#else
+ return (unsigned int)toupper((int)ch);
+#endif
+}
-/* defining this one enables tracing */
-#undef VERBOSE
+/* Defining this one controls tracing:
+ * 0 -- disabled
+ * 1 -- only if the DEBUG flag set
+ * 2 -- always
+ */
+#ifndef VERBOSE
+# define VERBOSE 0
+#endif
/* -------------------------------------------------------------------- */
@@ -72,10 +107,24 @@ static const char copyright[] =
#define SRE_ERROR_MEMORY -9 /* out of memory */
#define SRE_ERROR_INTERRUPTED -10 /* signal handler raised exception */
-#if defined(VERBOSE)
-#define TRACE(v) printf v
+#if VERBOSE == 0
+# define INIT_TRACE(state)
+# define DO_TRACE 0
+# define TRACE(v)
+#elif VERBOSE == 1
+# define INIT_TRACE(state) int _debug = (state)->debug
+# define DO_TRACE (_debug)
+# define TRACE(v) do { \
+ if (_debug) { \
+ printf v; \
+ } \
+ } while (0)
+#elif VERBOSE == 2
+# define INIT_TRACE(state)
+# define DO_TRACE 1
+# define TRACE(v) printf v
#else
-#define TRACE(v)
+# error VERBOSE must be 0, 1 or 2
#endif
/* -------------------------------------------------------------------- */
@@ -98,17 +147,17 @@ static unsigned int sre_lower_ascii(unsigned int ch)
/* locale-specific character predicates */
/* !(c & ~N) == (c < N+1) for any unsigned c, this avoids
* warnings when c's type supports only numbers < N+1 */
-#define SRE_LOC_IS_ALNUM(ch) (!((ch) & ~255) ? isalnum((ch)) : 0)
+#define SRE_LOC_IS_ALNUM(ch) (!((ch) & ~255) ? sre_isalnum((ch)) : 0)
#define SRE_LOC_IS_WORD(ch) (SRE_LOC_IS_ALNUM((ch)) || (ch) == '_')
static unsigned int sre_lower_locale(unsigned int ch)
{
- return ((ch) < 256 ? (unsigned int)tolower((ch)) : ch);
+ return ((ch) < 256 ? (unsigned int)sre_tolower((ch)) : ch);
}
static unsigned int sre_upper_locale(unsigned int ch)
{
- return ((ch) < 256 ? (unsigned int)toupper((ch)) : ch);
+ return ((ch) < 256 ? (unsigned int)sre_toupper((ch)) : ch);
}
/* unicode-specific character predicates */
@@ -200,6 +249,7 @@ data_stack_dealloc(SRE_STATE* state)
static int
data_stack_grow(SRE_STATE* state, Py_ssize_t size)
{
+ INIT_TRACE(state);
Py_ssize_t minsize, cursize;
minsize = state->data_stack_base+size;
cursize = state->data_stack_size;
@@ -235,7 +285,7 @@ repeat_pool_malloc(SRE_STATE *state)
state->repeat_pool_unused = repeat->pool_next;
}
else {
- repeat = PyObject_Malloc(sizeof(SRE_REPEAT));
+ repeat = PyMem_Malloc(sizeof(SRE_REPEAT));
if (!repeat) {
return NULL;
}
@@ -284,7 +334,7 @@ repeat_pool_clear(SRE_STATE *state)
while (next) {
SRE_REPEAT *temp = next;
next = temp->pool_next;
- PyObject_Free(temp);
+ PyMem_Free(temp);
}
/* clear unused pool */
@@ -293,7 +343,7 @@ repeat_pool_clear(SRE_STATE *state)
while (next) {
SRE_REPEAT *temp = next;
next = temp->pool_next;
- PyObject_Free(temp);
+ PyMem_Free(temp);
}
}
@@ -453,8 +503,6 @@ getstring(PyObject* string, Py_ssize_t* p_length,
/* Unicode objects do not support the buffer API. So, get the data
directly instead. */
if (PyUnicode_Check(string)) {
- if (PyUnicode_READY(string) == -1)
- return NULL;
*p_length = PyUnicode_GET_LENGTH(string);
*p_charsize = PyUnicode_KIND(string);
*p_isbytes = 0;
@@ -532,6 +580,7 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,
state->charsize = charsize;
state->match_all = 0;
state->must_advance = 0;
+ state->debug = ((pattern->flags & SRE_FLAG_DEBUG) != 0);
state->beginning = ptr;
@@ -681,9 +730,7 @@ pattern_dealloc(PatternObject* self)
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
- if (self->weakreflist != NULL) {
- PyObject_ClearWeakRefs((PyObject *) self);
- }
+ FT_CLEAR_WEAKREFS((PyObject *) self, self->weakreflist);
(void)pattern_clear(self);
tp->tp_free(self);
Py_DECREF(tp);
@@ -737,6 +784,7 @@ _sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls,
if (!state_init(&state, self, string, pos, endpos))
return NULL;
+ INIT_TRACE(&state);
state.ptr = state.start;
TRACE(("|%p|%p|MATCH\n", PatternObject_GetCode(self), state.ptr));
@@ -780,6 +828,7 @@ _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls,
if (!state_init(&state, self, string, pos, endpos))
return NULL;
+ INIT_TRACE(&state);
state.ptr = state.start;
TRACE(("|%p|%p|FULLMATCH\n", PatternObject_GetCode(self), state.ptr));
@@ -826,6 +875,7 @@ _sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls,
if (!state_init(&state, self, string, pos, endpos))
return NULL;
+ INIT_TRACE(&state);
TRACE(("|%p|%p|SEARCH\n", PatternObject_GetCode(self), state.ptr));
status = sre_search(&state, PatternObject_GetCode(self));
@@ -1109,13 +1159,21 @@ compile_template(_sremodulestate *module_state,
PatternObject *pattern, PyObject *template)
{
/* delegate to Python code */
- PyObject *func = module_state->compile_template;
+ PyObject *func = FT_ATOMIC_LOAD_PTR(module_state->compile_template);
if (func == NULL) {
func = _PyImport_GetModuleAttrString("re", "_compile_template");
if (func == NULL) {
return NULL;
}
+#ifdef Py_GIL_DISABLED
+ PyObject *other_func = NULL;
+ if (!_Py_atomic_compare_exchange_ptr(&module_state->compile_template, &other_func, func)) {
+ Py_DECREF(func);
+ func = other_func;
+ }
+#else
Py_XSETREF(module_state->compile_template, func);
+#endif
}
PyObject *args[] = {(PyObject *)pattern, template};
@@ -1452,7 +1510,6 @@ pattern_repr(PatternObject *obj)
const char *name;
int value;
} flag_names[] = {
- {"re.TEMPLATE", SRE_FLAG_TEMPLATE},
{"re.IGNORECASE", SRE_FLAG_IGNORECASE},
{"re.LOCALE", SRE_FLAG_LOCALE},
{"re.MULTILINE", SRE_FLAG_MULTILINE},
@@ -1875,7 +1932,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
sre_match() code is robust even if they don't, and the worst
you can get is nonsensical match results. */
GET_ARG;
- if (arg > 2 * (size_t)groups + 1) {
+ if (arg >= 2 * (size_t)groups) {
VTRACE(("arg=%d, groups=%d\n", (int)arg, (int)groups));
FAIL;
}
@@ -2422,26 +2479,28 @@ _sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value)
if (!result || !self->pattern->groupindex)
return result;
+ Py_BEGIN_CRITICAL_SECTION(self->pattern->groupindex);
while (_PyDict_Next(self->pattern->groupindex, &pos, &key, &value, &hash)) {
int status;
Py_INCREF(key);
value = match_getslice(self, key, default_value);
if (!value) {
Py_DECREF(key);
- goto failed;
+ Py_CLEAR(result);
+ goto exit;
}
status = _PyDict_SetItem_KnownHash(result, key, value, hash);
Py_DECREF(value);
Py_DECREF(key);
- if (status < 0)
- goto failed;
+ if (status < 0) {
+ Py_CLEAR(result);
+ goto exit;
+ }
}
+exit:;
+ Py_END_CRITICAL_SECTION();
return result;
-
-failed:
- Py_DECREF(result);
- return NULL;
}
/*[clinic input]
@@ -3103,13 +3162,13 @@ static PyGetSetDef pattern_getset[] = {
#define PAT_OFF(x) offsetof(PatternObject, x)
static PyMemberDef pattern_members[] = {
- {"pattern", T_OBJECT, PAT_OFF(pattern), READONLY,
+ {"pattern", _Py_T_OBJECT, PAT_OFF(pattern), Py_READONLY,
"The pattern string from which the RE object was compiled."},
- {"flags", T_INT, PAT_OFF(flags), READONLY,
+ {"flags", Py_T_INT, PAT_OFF(flags), Py_READONLY,
"The regex matching flags."},
- {"groups", T_PYSSIZET, PAT_OFF(groups), READONLY,
+ {"groups", Py_T_PYSSIZET, PAT_OFF(groups), Py_READONLY,
"The number of capturing groups in the pattern."},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(PatternObject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(PatternObject, weakreflist), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -3162,13 +3221,13 @@ static PyGetSetDef match_getset[] = {
#define MATCH_OFF(x) offsetof(MatchObject, x)
static PyMemberDef match_members[] = {
- {"string", T_OBJECT, MATCH_OFF(string), READONLY,
+ {"string", _Py_T_OBJECT, MATCH_OFF(string), Py_READONLY,
"The string passed to match() or search()."},
- {"re", T_OBJECT, MATCH_OFF(pattern), READONLY,
+ {"re", _Py_T_OBJECT, MATCH_OFF(pattern), Py_READONLY,
"The regular expression object."},
- {"pos", T_PYSSIZET, MATCH_OFF(pos), READONLY,
+ {"pos", Py_T_PYSSIZET, MATCH_OFF(pos), Py_READONLY,
"The index into the string at which the RE engine started looking for a match."},
- {"endpos", T_PYSSIZET, MATCH_OFF(endpos), READONLY,
+ {"endpos", Py_T_PYSSIZET, MATCH_OFF(endpos), Py_READONLY,
"The index into the string beyond which the RE engine will not go."},
{NULL}
};
@@ -3212,7 +3271,7 @@ static PyMethodDef scanner_methods[] = {
#define SCAN_OFF(x) offsetof(ScannerObject, x)
static PyMemberDef scanner_members[] = {
- {"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
+ {"pattern", _Py_T_OBJECT, SCAN_OFF(pattern), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -3304,12 +3363,7 @@ do { \
#define ADD_ULONG_CONSTANT(module, name, value) \
do { \
- PyObject *o = PyLong_FromUnsignedLong(value); \
- if (!o) \
- goto error; \
- int res = PyModule_AddObjectRef(module, name, o); \
- Py_DECREF(o); \
- if (res < 0) { \
+ if (PyModule_Add(module, name, PyLong_FromUnsignedLong(value)) < 0) { \
goto error; \
} \
} while (0)
@@ -3350,6 +3404,7 @@ error:
static PyModuleDef_Slot sre_slots[] = {
{Py_mod_exec, sre_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
+ {Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};
diff --git a/contrib/tools/python3/Modules/_sre/sre.h b/contrib/tools/python3/Modules/_sre/sre.h
index b8c6f8e3e66..42681c2addf 100644
--- a/contrib/tools/python3/Modules/_sre/sre.h
+++ b/contrib/tools/python3/Modules/_sre/sre.h
@@ -92,6 +92,7 @@ typedef struct {
int charsize; /* character size */
int match_all;
int must_advance;
+ int debug;
/* marks */
int lastmark;
int lastindex;
diff --git a/contrib/tools/python3/Modules/_sre/sre_constants.h b/contrib/tools/python3/Modules/_sre/sre_constants.h
index b5692292f65..bd611b33614 100644
--- a/contrib/tools/python3/Modules/_sre/sre_constants.h
+++ b/contrib/tools/python3/Modules/_sre/sre_constants.h
@@ -11,7 +11,7 @@
* See the sre.c file for information on usage and redistribution.
*/
-#define SRE_MAGIC 20221023
+#define SRE_MAGIC 20230612
#define SRE_OP_FAILURE 0
#define SRE_OP_SUCCESS 1
#define SRE_OP_ANY 2
@@ -85,7 +85,6 @@
#define SRE_CATEGORY_UNI_NOT_WORD 15
#define SRE_CATEGORY_UNI_LINEBREAK 16
#define SRE_CATEGORY_UNI_NOT_LINEBREAK 17
-#define SRE_FLAG_TEMPLATE 1
#define SRE_FLAG_IGNORECASE 2
#define SRE_FLAG_LOCALE 4
#define SRE_FLAG_MULTILINE 8
diff --git a/contrib/tools/python3/Modules/_sre/sre_lib.h b/contrib/tools/python3/Modules/_sre/sre_lib.h
index 9e9a0ec9268..af4bfc56083 100644
--- a/contrib/tools/python3/Modules/_sre/sre_lib.h
+++ b/contrib/tools/python3/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)
@@ -372,6 +373,19 @@ SRE(count)(SRE_STATE* state, const SRE_CODE* pattern, Py_ssize_t maxcount)
state->lastindex = ctx->lastindex; \
} while (0)
+#define LAST_PTR_PUSH() \
+ do { \
+ TRACE(("push last_ptr: %zd", \
+ PTR_TO_INDEX(ctx->u.rep->last_ptr))); \
+ DATA_PUSH(&ctx->u.rep->last_ptr); \
+ } while (0)
+#define LAST_PTR_POP() \
+ do { \
+ DATA_POP(&ctx->u.rep->last_ptr); \
+ TRACE(("pop last_ptr: %zd", \
+ PTR_TO_INDEX(ctx->u.rep->last_ptr))); \
+ } while (0)
+
#define RETURN_ERROR(i) do { return i; } while(0)
#define RETURN_FAILURE do { ret = 0; goto exit; } while(0)
#define RETURN_SUCCESS do { ret = 1; goto exit; } while(0)
@@ -448,8 +462,27 @@ do { \
#define DATA_LOOKUP_AT(t,p,pos) \
DATA_STACK_LOOKUP_AT(state,t,p,pos)
+#define PTR_TO_INDEX(ptr) \
+ ((ptr) ? ((char*)(ptr) - (char*)state->beginning) / state->charsize : -1)
+
+#if VERBOSE
+# define MARK_TRACE(label, lastmark) \
+ do if (DO_TRACE) { \
+ TRACE(("%s %d marks:", (label), (lastmark)+1)); \
+ for (int j = 0; j <= (lastmark); j++) { \
+ if (j && (j & 1) == 0) { \
+ TRACE((" ")); \
+ } \
+ TRACE((" %zd", PTR_TO_INDEX(state->mark[j]))); \
+ } \
+ TRACE(("\n")); \
+ } while (0)
+#else
+# define MARK_TRACE(label, lastmark)
+#endif
#define MARK_PUSH(lastmark) \
do if (lastmark >= 0) { \
+ MARK_TRACE("push", (lastmark)); \
size_t _marks_size = (lastmark+1) * sizeof(void*); \
DATA_STACK_PUSH(state, state->mark, _marks_size); \
} while (0)
@@ -457,16 +490,19 @@ do { \
do if (lastmark >= 0) { \
size_t _marks_size = (lastmark+1) * sizeof(void*); \
DATA_STACK_POP(state, state->mark, _marks_size, 1); \
+ MARK_TRACE("pop", (lastmark)); \
} while (0)
#define MARK_POP_KEEP(lastmark) \
do if (lastmark >= 0) { \
size_t _marks_size = (lastmark+1) * sizeof(void*); \
DATA_STACK_POP(state, state->mark, _marks_size, 0); \
+ MARK_TRACE("pop keep", (lastmark)); \
} while (0)
#define MARK_POP_DISCARD(lastmark) \
do if (lastmark >= 0) { \
size_t _marks_size = (lastmark+1) * sizeof(void*); \
DATA_STACK_POP_DISCARD(state, _marks_size); \
+ MARK_TRACE("pop discard", (lastmark)); \
} while (0)
#define JUMP_NONE 0
@@ -582,6 +618,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));
@@ -1160,11 +1197,11 @@ dispatch:
LASTMARK_SAVE();
MARK_PUSH(ctx->lastmark);
/* zero-width match protection */
- DATA_PUSH(&ctx->u.rep->last_ptr);
+ LAST_PTR_PUSH();
ctx->u.rep->last_ptr = state->ptr;
DO_JUMP(JUMP_MAX_UNTIL_2, jump_max_until_2,
ctx->u.rep->pattern+3);
- DATA_POP(&ctx->u.rep->last_ptr);
+ LAST_PTR_POP();
if (ret) {
MARK_POP_DISCARD(ctx->lastmark);
RETURN_ON_ERROR(ret);
@@ -1245,11 +1282,11 @@ dispatch:
ctx->u.rep->count = ctx->count;
/* zero-width match protection */
- DATA_PUSH(&ctx->u.rep->last_ptr);
+ LAST_PTR_PUSH();
ctx->u.rep->last_ptr = state->ptr;
DO_JUMP(JUMP_MIN_UNTIL_3,jump_min_until_3,
ctx->u.rep->pattern+3);
- DATA_POP(&ctx->u.rep->last_ptr);
+ LAST_PTR_POP();
if (ret) {
RETURN_ON_ERROR(ret);
RETURN_SUCCESS;
@@ -1675,6 +1712,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;