diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-09-18 18:47:09 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-09-18 18:47:09 (GMT) |
commit | 21009b9c6fc40b25fcb30ee60d6108f235733e40 (patch) | |
tree | 47c8d39976e3538852a97d33ca57a9a93e6585a8 /Modules | |
parent | 18d8d5a708dda187e1ff733f955920d7d5723446 (diff) | |
download | cpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.zip cpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.tar.gz cpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.tar.bz2 |
an SRE bugfix a day keeps Guido away...
#462270: sub-tle difference between pre.sub and sre.sub. PRE ignored
an empty match at the previous location, SRE didn't.
also synced with Secret Labs "sreopen" codebase.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index d6f39a4..b0ab663 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -31,6 +31,7 @@ * 2001-04-28 fl added __copy__ methods (work in progress) * 2001-05-14 fl fixes for 1.5.2 * 2001-07-01 fl added BIGCHARSET support (from Martin von Loewis) + * 2001-09-18 fl * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. * @@ -133,6 +134,8 @@ static char copyright[] = #define SRE_ALNUM_MASK 8 #define SRE_WORD_MASK 16 +/* FIXME: this assumes ASCII. create tables in init_sre() instead */ + static char sre_char_info[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, @@ -1141,6 +1144,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) } /* can't end up here */ + /* return SRE_ERROR_ILLEGAL; -- see python-dev discussion */ } LOCAL(int) @@ -2624,16 +2628,17 @@ init_sre(void) m = Py_InitModule("_" SRE_MODULE, _functions); d = PyModule_GetDict(m); - PyDict_SetItemString( - d, "MAGIC", (x = (PyObject*) PyInt_FromLong(SRE_MAGIC)) - ); - Py_XDECREF(x); - - PyDict_SetItemString( - d, "copyright", (x = (PyObject*)PyString_FromString(copyright)) - ); - Py_XDECREF(x); + x = PyInt_FromLong(SRE_MAGIC); + if (x) { + PyDict_SetItemString(d, "MAGIC", x); + Py_DECREF(x); + } + x = PyString_FromString(copyright); + if (x) { + PyDict_SetItemString(d, "copyright", x); + Py_DECREF(x); + } } #endif /* !defined(SRE_RECURSIVE) */ |