[Python-Dev] re.finditer
Seo Sanghyeon
tinuviel at sparcs.kaist.ac.kr
Wed Oct 1 23:59:54 EDT 2003
Hello, python-dev!
This is my first mail to python-dev.
Attached one line patch fixes re.finditer bug reported by
Kevin J. Butler. I read cvs log to find out why this code is
introduced, and it seems to be related to SF bug #581080.
But that bug didn't appear after my patch, so I wonder
why it was introduced in the first place. It seems beyond
my understanding. Please enlighten me.
To test:
#581080
import re
list(re.finditer('\s', 'a b'))
# expected: one item list
# bug: hang
#Kevin J. Butler
import re
list(re.finditer('.*', 'asdf'))
# expected: two item list (?)
# bug: hang
Seo Sanghyeon
-------------- next part --------------
? patch
Index: Modules/_sre.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
retrieving revision 2.99
diff -c -r2.99 _sre.c
*** Modules/_sre.c 26 Jun 2003 14:41:08 -0000 2.99
--- Modules/_sre.c 2 Oct 2003 03:48:55 -0000
***************
*** 3062,3069 ****
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
! if ((status == 0 || state->ptr == state->start) &&
! state->ptr < state->end)
state->start = (void*) ((char*) state->ptr + state->charsize);
else
state->start = state->ptr;
--- 3062,3068 ----
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
! if (status == 0 || state->ptr == state->start)
state->start = (void*) ((char*) state->ptr + state->charsize);
else
state->start = state->ptr;
More information about the Python-Dev
mailing list