summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2000-09-29 19:05:48 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2000-09-29 19:05:48 (GMT)
commitc0718eba21c6e8157d9f3ea00d7b2bac1fb7e0a2 (patch)
tree84af6fa2fbc5b69a59f5d6428aaf9be1cc8d2c68 /Modules
parent3f0969f100a565a239f3504b50ab8e31d6e81b14 (diff)
downloadcpython-c0718eba21c6e8157d9f3ea00d7b2bac1fb7e0a2.zip
cpython-c0718eba21c6e8157d9f3ea00d7b2bac1fb7e0a2.tar.gz
cpython-c0718eba21c6e8157d9f3ea00d7b2bac1fb7e0a2.tar.bz2
Remove unused VERSION #define.
Add PyModule_AddStringConstant and PyModule_AddObject if version <2.0, to allow to share this file with PyXML.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/pyexpat.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 7ab5171..8ef36d8 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1,11 +1,6 @@
#include "Python.h"
#include "xmlparse.h"
-/*
-** The version number should match the one in _checkversion
-*/
-#define VERSION "1.9"
-
enum HandlerTypes {
StartElement,
EndElement,
@@ -864,6 +859,32 @@ static char pyexpat_module_documentation[] =
void initpyexpat(void); /* avoid compiler warnings */
+#if PY_VERSION_HEX < 0x2000000
+
+/* 1.5 compatibility: PyModule_AddObject */
+static int
+PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+{
+ PyObject *dict;
+ if (!PyModule_Check(m) || o == NULL)
+ return -1;
+ dict = PyModule_GetDict(m);
+ if (dict == NULL)
+ return -1;
+ if (PyDict_SetItemString(dict, name, o))
+ return -1;
+ Py_DECREF(o);
+ return 0;
+}
+
+int
+PyModule_AddStringConstant(PyObject *m, char *name, char *value)
+{
+ return PyModule_AddObject(m, name, PyString_FromString(value));
+}
+
+#endif
+
DL_EXPORT(void)
initpyexpat(void)
{