mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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.
This commit is contained in:
parent
18d8d5a708
commit
21009b9c6f
3 changed files with 25 additions and 13 deletions
|
|
@ -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) */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue