Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b28467b

Browse files
committed
Do not depend on pymemcompat.h (was only used for PyXML); Martin likes
it all inline.
1 parent 84262fb commit b28467b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Modules/pyexpat.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#include "Python.h"
22
#include <ctype.h>
33

4-
#ifdef HAVE_PYMEMCOMPAT_H
5-
#include "pymemcompat.h"
6-
#endif
7-
84
#include "compile.h"
95
#include "frameobject.h"
106
#include "expat.h"
@@ -973,7 +969,13 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
973969
if (self->buffer != NULL) {
974970
new_parser->buffer = malloc(new_parser->buffer_size);
975971
if (new_parser->buffer == NULL) {
972+
#ifndef Py_TPFLAGS_HAVE_GC
973+
/* Code for versions 2.0 and 2.1 */
974+
PyObject_Del(new_parser);
975+
#else
976+
/* Code for versions 2.2 and later. */
976977
PyObject_GC_Del(new_parser);
978+
#endif
977979
return PyErr_NoMemory();
978980
}
979981
}

0 commit comments

Comments
 (0)