[Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.25,2.26
Martin v. Löwis
python-dev@python.org
Fri, 29 Sep 2000 12:05:52 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv766
Modified Files:
pyexpat.c
Log Message:
Remove unused VERSION #define.
Add PyModule_AddStringConstant and PyModule_AddObject if version <2.0,
to allow to share this file with PyXML.
Index: pyexpat.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v
retrieving revision 2.25
retrieving revision 2.26
diff -C2 -r2.25 -r2.26
*** pyexpat.c 2000/09/24 22:12:45 2.25
--- pyexpat.c 2000/09/29 19:05:48 2.26
***************
*** 2,10 ****
#include "xmlparse.h"
- /*
- ** The version number should match the one in _checkversion
- */
- #define VERSION "1.9"
-
enum HandlerTypes {
StartElement,
--- 2,5 ----
***************
*** 864,867 ****
--- 859,888 ----
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)