summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sre_compile.py2
-rw-r--r--Lib/sre_constants.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index adab767..c2996fc 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -12,6 +12,8 @@ import _sre
from sre_constants import *
+assert _sre.MAGIC == MAGIC, "SRE module mismatch"
+
MAXCODE = 65535
def _compile(code, pattern, flags):
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
index a5e4bb8..b429a33 100644
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -9,8 +9,15 @@
# See the sre.py file for information on usage and redistribution.
#
+# update when constants are added or removed
+
+MAGIC = 20010115
+
+# max code word in this release
+
MAXREPEAT = 65535
+# SRE standard exception (access as sre.error)
# should this really be here?
class error(Exception):
@@ -211,6 +218,8 @@ if __name__ == "__main__":
""")
+ f.write("#define SRE_MAGIC %d\n" % MAGIC)
+
dump(f, OPCODES, "SRE_OP")
dump(f, ATCODES, "SRE")
dump(f, CHCODES, "SRE")