|
5 | 5 | * |
6 | 6 | * partial history: |
7 | 7 | * 1999-10-24 fl created (based on existing template matcher code) |
8 | | - * 2000-03-06 fl first alpha, sort of (0.5) |
9 | | - * 2000-06-30 fl added fast search optimization (0.9.3) |
10 | | - * 2000-06-30 fl added assert (lookahead) primitives, etc (0.9.4) |
11 | | - * 2000-07-02 fl added charset optimizations, etc (0.9.5) |
| 8 | + * 2000-03-06 fl first alpha, sort of |
| 9 | + * 2000-06-30 fl added fast search optimization |
| 10 | + * 2000-06-30 fl added assert (lookahead) primitives, etc |
| 11 | + * 2000-07-02 fl added charset optimizations, etc |
12 | 12 | * 2000-07-03 fl store code in pattern object, lookbehind, etc |
13 | 13 | * 2000-07-08 fl added regs attribute |
14 | | - * 2000-07-21 fl reset lastindex in scanner methods (0.9.6) |
15 | | - * 2000-08-01 fl fixes for 1.6b1 (0.9.8) |
| 14 | + * 2000-07-21 fl reset lastindex in scanner methods |
| 15 | + * 2000-08-01 fl fixes for 1.6b1 |
16 | 16 | * 2000-08-03 fl added recursion limit |
17 | 17 | * 2000-08-07 fl use PyOS_CheckStack() if available |
18 | 18 | * 2000-08-08 fl changed findall to return empty strings instead of None |
|
21 | 21 | * 2000-09-20 fl added expand method |
22 | 22 | * 2000-09-21 fl don't use the buffer interface for unicode strings |
23 | 23 | * 2000-10-03 fl fixed assert_not primitive; support keyword arguments |
| 24 | + * 2000-10-24 fl really fixed assert_not; reset groups in findall |
24 | 25 | * |
25 | 26 | * Copyright (c) 1997-2000 by Secret Labs AB. All rights reserved. |
26 | 27 | * |
|
35 | 36 |
|
36 | 37 | #ifndef SRE_RECURSIVE |
37 | 38 |
|
38 | | -char copyright[] = " SRE 0.9.8 Copyright (c) 1997-2000 by Secret Labs AB "; |
| 39 | +char copyright[] = " SRE 0.9.9 Copyright (c) 1997-2000 by Secret Labs AB "; |
39 | 40 |
|
40 | 41 | #include "Python.h" |
41 | 42 |
|
@@ -783,13 +784,13 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) |
783 | 784 | /* <ASSERT_NOT> <skip> <back> <pattern> */ |
784 | 785 | TRACE(("|%p|%p|ASSERT_NOT %d\n", pattern, ptr, pattern[1])); |
785 | 786 | state->ptr = ptr - pattern[1]; |
786 | | - if (state->ptr < state->beginning) |
787 | | - return 0; |
788 | | - i = SRE_MATCH(state, pattern + 2, level + 1); |
789 | | - if (i < 0) |
790 | | - return i; |
791 | | - if (i) |
792 | | - return 0; |
| 787 | + if (state->ptr >= state->beginning) { |
| 788 | + i = SRE_MATCH(state, pattern + 2, level + 1); |
| 789 | + if (i < 0) |
| 790 | + return i; |
| 791 | + if (i) |
| 792 | + return 0; |
| 793 | + } |
793 | 794 | pattern += pattern[0]; |
794 | 795 | break; |
795 | 796 |
|
@@ -1199,7 +1200,7 @@ _compile(PyObject* self_, PyObject* args) |
1199 | 1200 | n = PySequence_Length(code); |
1200 | 1201 | #endif |
1201 | 1202 |
|
1202 | | - self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, 100*n); |
| 1203 | + self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, n); |
1203 | 1204 | if (!self) { |
1204 | 1205 | Py_DECREF(code); |
1205 | 1206 | return NULL; |
@@ -1680,6 +1681,8 @@ pattern_findall(PatternObject* self, PyObject* args, PyObject* kw) |
1680 | 1681 |
|
1681 | 1682 | PyObject* item; |
1682 | 1683 |
|
| 1684 | + state_reset(&state); |
| 1685 | + |
1683 | 1686 | state.ptr = state.start; |
1684 | 1687 |
|
1685 | 1688 | if (state.charsize == 1) { |
|
0 commit comments