diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-01-15 12:46:09 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-01-15 12:46:09 (GMT) |
commit | b35ffc0417a0861ccf466c0503c4151725a0267a (patch) | |
tree | be88aec0ae5d7988418b45a29b90dda7a8c37d0c /Modules | |
parent | 142297ac9204042743c72cee04ec501236c7986d (diff) | |
download | cpython-b35ffc0417a0861ccf466c0503c4151725a0267a.zip cpython-b35ffc0417a0861ccf466c0503c4151725a0267a.tar.gz cpython-b35ffc0417a0861ccf466c0503c4151725a0267a.tar.bz2 |
added "magic" number to the _sre module, to avoid weird errors caused
by compiler/engine mismatches
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 10 | ||||
-rw-r--r-- | Modules/sre_constants.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index b040d87..efb704b 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2355,11 +2355,19 @@ __declspec(dllexport) #endif init_sre(void) { + PyObject* m; + PyObject* d; + /* Patch object types */ Pattern_Type.ob_type = Match_Type.ob_type = Scanner_Type.ob_type = &PyType_Type; - Py_InitModule("_" MODULE, _functions); + m = Py_InitModule("_" MODULE, _functions); + d = PyModule_GetDict(m); + + PyDict_SetItemString( + d, "MAGIC", (PyObject*) PyInt_FromLong(SRE_MAGIC) + ); } #endif /* !defined(SRE_RECURSIVE) */ diff --git a/Modules/sre_constants.h b/Modules/sre_constants.h index 6cad089..c6850ad 100644 --- a/Modules/sre_constants.h +++ b/Modules/sre_constants.h @@ -11,6 +11,7 @@ * See the _sre.c file for information on usage and redistribution. */ +#define SRE_MAGIC 20010115 #define SRE_OP_FAILURE 0 #define SRE_OP_SUCCESS 1 #define SRE_OP_ANY 2 |