mirror of
https://github.com/python/cpython.git
synced 2025-11-15 16:09:29 +00:00
Remove unused VERSION #define.
Add PyModule_AddStringConstant and PyModule_AddObject if version <2.0, to allow to share this file with PyXML.
This commit is contained in:
parent
3f0969f100
commit
c0718eba21
1 changed files with 26 additions and 5 deletions
|
|
@ -1,11 +1,6 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "xmlparse.h"
|
#include "xmlparse.h"
|
||||||
|
|
||||||
/*
|
|
||||||
** The version number should match the one in _checkversion
|
|
||||||
*/
|
|
||||||
#define VERSION "1.9"
|
|
||||||
|
|
||||||
enum HandlerTypes {
|
enum HandlerTypes {
|
||||||
StartElement,
|
StartElement,
|
||||||
EndElement,
|
EndElement,
|
||||||
|
|
@ -864,6 +859,32 @@ static char pyexpat_module_documentation[] =
|
||||||
|
|
||||||
void initpyexpat(void); /* avoid compiler warnings */
|
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)
|
DL_EXPORT(void)
|
||||||
initpyexpat(void)
|
initpyexpat(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue