summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sre.c23
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) */