@@ -93,27 +93,6 @@ do { memory -= size; printf("%8d - %s\n", memory, comment); } while (0)
9393#define LOCAL (type ) static type
9494#endif
9595
96- /* compatibility macros */
97- #if (PY_VERSION_HEX < 0x02050000 )
98- typedef int Py_ssize_t ;
99- #define lenfunc inquiry
100- #endif
101-
102- #if (PY_VERSION_HEX < 0x02040000 )
103- #define PyDict_CheckExact PyDict_Check
104- #if (PY_VERSION_HEX < 0x02020000 )
105- #define PyList_CheckExact PyList_Check
106- #define PyString_CheckExact PyString_Check
107- #if (PY_VERSION_HEX >= 0x01060000 )
108- #define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */
109- #endif
110- #endif
111- #endif
112-
113- #if !defined(Py_RETURN_NONE )
114- #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
115- #endif
116-
11796/* macros used to store 'join' flags in string object pointers. note
11897 that all use of text and tail as object pointers must be wrapped in
11998 JOIN_OBJ. see comments in the ElementObject definition for more
@@ -724,7 +703,6 @@ checkpath(PyObject* tag)
724703
725704#define PATHCHAR (ch ) (ch == '/' || ch == '*' || ch == '[' || ch == '@')
726705
727- #if defined(Py_USING_UNICODE )
728706 if (PyUnicode_Check (tag )) {
729707 Py_UNICODE * p = PyUnicode_AS_UNICODE (tag );
730708 for (i = 0 ; i < PyUnicode_GET_SIZE (tag ); i ++ ) {
@@ -737,7 +715,6 @@ checkpath(PyObject* tag)
737715 }
738716 return 0 ;
739717 }
740- #endif
741718 if (PyString_Check (tag )) {
742719 char * p = PyString_AS_STRING (tag );
743720 for (i = 0 ; i < PyString_GET_SIZE (tag ); i ++ ) {
@@ -1860,7 +1837,6 @@ static PyTypeObject XMLParser_Type;
18601837
18611838/* helpers */
18621839
1863- #if defined(Py_USING_UNICODE )
18641840LOCAL (int )
18651841checkstring (const char * string , int size )
18661842{
@@ -1873,18 +1849,15 @@ checkstring(const char* string, int size)
18731849
18741850 return 0 ;
18751851}
1876- #endif
18771852
18781853LOCAL (PyObject * )
18791854makestring (const char * string , int size )
18801855{
18811856 /* convert a UTF-8 string to either a 7-bit ascii string or a
18821857 Unicode string */
18831858
1884- #if defined(Py_USING_UNICODE )
18851859 if (checkstring (string , size ))
18861860 return PyUnicode_DecodeUTF8 (string , size , "strict" );
1887- #endif
18881861
18891862 return PyString_FromStringAndSize (string , size );
18901863}
@@ -1934,7 +1907,6 @@ makeuniversal(XMLParserObject* self, const char* string)
19341907 }
19351908
19361909 /* decode universal name */
1937- #if defined(Py_USING_UNICODE )
19381910 /* inline makestring, to avoid duplicating the source string if
19391911 it's not an utf-8 string */
19401912 p = PyString_AS_STRING (tag );
@@ -1946,7 +1918,6 @@ makeuniversal(XMLParserObject* self, const char* string)
19461918 return NULL ;
19471919 }
19481920 } else
1949- #endif
19501921 value = tag ; /* use tag as is */
19511922
19521923 /* add to names dictionary */
@@ -2163,7 +2134,6 @@ expat_pi_handler(XMLParserObject* self, const XML_Char* target_in,
21632134 }
21642135}
21652136
2166- #if defined(Py_USING_UNICODE )
21672137static int
21682138expat_unknown_encoding_handler (XMLParserObject * self , const XML_Char * name ,
21692139 XML_Encoding * info )
@@ -2200,7 +2170,6 @@ expat_unknown_encoding_handler(XMLParserObject *self, const XML_Char *name,
22002170
22012171 return XML_STATUS_OK ;
22022172}
2203- #endif
22042173
22052174/* -------------------------------------------------------------------- */
22062175/* constructor and destructor */
@@ -2306,12 +2275,10 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw)
23062275 self -> parser ,
23072276 (XML_ProcessingInstructionHandler ) expat_pi_handler
23082277 );
2309- #if defined(Py_USING_UNICODE )
23102278 EXPAT (SetUnknownEncodingHandler )(
23112279 self -> parser ,
23122280 (XML_UnknownEncodingHandler ) expat_unknown_encoding_handler , NULL
23132281 );
2314- #endif
23152282
23162283 ALLOC (sizeof (XMLParserObject ), "create expatparser" );
23172284
0 commit comments