Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b4fcf4d1
Commit
b4fcf4d1
authored
Jun 30, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define PyDoc_STRVAR if it is not available (PyXML 1.54).
Remove support for Python 1.5 (PyXML 1.55).
parent
6b2cf0e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
63 deletions
+11
-63
Modules/pyexpat.c
Modules/pyexpat.c
+11
-63
No files found.
Modules/pyexpat.c
View file @
b4fcf4d1
#include "Python.h"
#if PY_VERSION_HEX < 0x020000B1
#include <assert.h>
#endif
#include <ctype.h>
#include "compile.h"
#include "frameobject.h"
#include "expat.h"
#ifndef PyGC_HEAD_SIZE
#define PyGC_HEAD_SIZE 0
#define PyObject_GC_Init(x)
#define PyObject_GC_Fini(m)
#define Py_TPFLAGS_GC 0
#ifndef PyDoc_STRVAR
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
#endif
#if (PY_MAJOR_VERSION ==
1 && PY_MINOR_VERSION > 5) || (PY_MAJOR_VERSION ==
2 && PY_MINOR_VERSION < 2)
/* In Python
1.6,
2.0 and 2.1, disabling Unicode was not possible. */
#if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 2)
/* In Python 2.0 and 2.1, disabling Unicode was not possible. */
#define Py_USING_UNICODE
#endif
...
...
@@ -297,7 +291,7 @@ call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args)
#ifndef Py_USING_UNICODE
#define STRING_CONV_FUNC conv_string_to_utf8
#else
/* Python
1.6
and later versions */
/* Python
2.0
and later versions */
#define STRING_CONV_FUNC (self->returns_unicode \
? conv_string_to_unicode : conv_string_to_utf8)
#endif
...
...
@@ -958,16 +952,12 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
return
NULL
;
}
#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
new_parser
=
PyObject_NEW
(
xmlparseobject
,
&
Xmlparsetype
);
#else
#ifndef Py_TPFLAGS_HAVE_GC
/* Python versions
1.6 to
2.1 */
/* Python versions
2.0 and
2.1 */
new_parser
=
PyObject_New
(
xmlparseobject
,
&
Xmlparsetype
);
#else
/* Python versions 2.2 and later */
new_parser
=
PyObject_GC_New
(
xmlparseobject
,
&
Xmlparsetype
);
#endif
#endif
if
(
new_parser
==
NULL
)
...
...
@@ -1127,14 +1117,6 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
int
i
;
xmlparseobject
*
self
;
#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
self
=
PyObject_NEW
(
xmlparseobject
,
&
Xmlparsetype
);
if
(
self
==
NULL
)
return
NULL
;
self
->
returns_unicode
=
0
;
#else
/* Code for versions 1.6 and later */
#ifdef Py_TPFLAGS_HAVE_GC
/* Code for versions 2.2 and later */
self
=
PyObject_GC_New
(
xmlparseobject
,
&
Xmlparsetype
);
...
...
@@ -1144,8 +1126,12 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
if
(
self
==
NULL
)
return
NULL
;
#ifdef Py_USING_UNICODE
self
->
returns_unicode
=
1
;
#else
self
->
returns_unicode
=
0
;
#endif
self
->
buffer
=
NULL
;
self
->
buffer_size
=
CHARACTER_DATA_BUFFER_SIZE
;
self
->
buffer_used
=
0
;
...
...
@@ -1219,18 +1205,13 @@ xmlparse_dealloc(xmlparseobject *self)
self
->
buffer
=
NULL
;
}
Py_XDECREF
(
self
->
intern
);
#if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6
/* Code for versions before 1.6 */
free
(
self
);
#else
#ifndef Py_TPFLAGS_HAVE_GC
/* Code for versions
1.6 to
2.1 */
/* Code for versions
2.0 and
2.1 */
PyObject_Del
(
self
);
#else
/* Code for versions 2.2 and later. */
PyObject_GC_Del
(
self
);
#endif
#endif
}
static
int
...
...
@@ -1563,39 +1544,6 @@ static struct PyMethodDef pyexpat_methods[] = {
PyDoc_STRVAR
(
pyexpat_module_documentation
,
"Python wrapper for Expat parser."
);
#if PY_VERSION_HEX < 0x20000F0
/* 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
;
}
static
int
PyModule_AddIntConstant
(
PyObject
*
m
,
char
*
name
,
long
value
)
{
return
PyModule_AddObject
(
m
,
name
,
PyInt_FromLong
(
value
));
}
static
int
PyModule_AddStringConstant
(
PyObject
*
m
,
char
*
name
,
char
*
value
)
{
return
PyModule_AddObject
(
m
,
name
,
PyString_FromString
(
value
));
}
#endif
/* Return a Python string that represents the version number without the
* extra cruft added by revision control, even if the right options were
* given to the "cvs export" command to make it not include the extra
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment