Commit 24fc085f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #1155 from kmod/reftests2

Fix some pyexpat issues
parents 6de98e5a a726eee9
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
#include "patchlevel.h" #include "patchlevel.h"
#include "pyconfig.h" #include "pyconfig.h"
/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the
* old symbol for the benefit of extension modules written before then
* that may be conditionalizing on it. The core doesn't use it anymore.
*/
#ifndef WITH_CYCLE_GC
#define WITH_CYCLE_GC 1
#endif
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
......
# expected: reffail
# - negative ref
from DocXMLRPCServer import DocXMLRPCServer from DocXMLRPCServer import DocXMLRPCServer
import httplib import httplib
import sys import sys
......
# expected: reffail
# - "pyexpat.xmlparser needs a tp_traverse"
# test for xml.dom.minidom # test for xml.dom.minidom
import pickle import pickle
......
# expected: fail # skip-if: True
# - This test hangs and the tester fails to clean it up.
# #
# Unit tests for the multiprocessing package # Unit tests for the multiprocessing package
# #
......
# expected: reffail
# - negative ref
# Copyright (C) 2003 Python Software Foundation # Copyright (C) 2003 Python Software Foundation
import unittest import unittest
......
# expected: reffail
# - "pyexpat.xmlparser needs a tp_traverse"
# regression test for SAX 2.0 -*- coding: utf-8 -*- # regression test for SAX 2.0 -*- coding: utf-8 -*-
# $Id$ # $Id$
......
# expected: reffail
# - unknown segfault
doctests = """ doctests = """
Unpack tuple Unpack tuple
......
...@@ -1143,9 +1143,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args) ...@@ -1143,9 +1143,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
for (i = 0; handler_info[i].name != NULL; i++) for (i = 0; handler_info[i].name != NULL; i++)
/* do nothing */; /* do nothing */;
// Pyston change: use GC alloc routine because those contain Python objects new_parser->handlers = malloc(sizeof(PyObject *) * i);
// new_parser->handlers = malloc(sizeof(PyObject *) * i);
new_parser->handlers = PyMem_Malloc(sizeof(PyObject *) * i);
if (!new_parser->handlers) { if (!new_parser->handlers) {
Py_DECREF(new_parser); Py_DECREF(new_parser);
return PyErr_NoMemory(); return PyErr_NoMemory();
...@@ -1364,9 +1362,7 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern) ...@@ -1364,9 +1362,7 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
for (i = 0; handler_info[i].name != NULL; i++) for (i = 0; handler_info[i].name != NULL; i++)
/* do nothing */; /* do nothing */;
// Pyston change: use GC alloc routine because those contain Python objects self->handlers = malloc(sizeof(PyObject *) * i);
// self->handlers = malloc(sizeof(PyObject *) * i);
self->handlers = PyMem_Malloc(sizeof(PyObject *) * i);
if (!self->handlers) { if (!self->handlers) {
Py_DECREF(self); Py_DECREF(self);
return PyErr_NoMemory(); return PyErr_NoMemory();
...@@ -1397,8 +1393,7 @@ xmlparse_dealloc(xmlparseobject *self) ...@@ -1397,8 +1393,7 @@ xmlparse_dealloc(xmlparseobject *self)
self->handlers[i] = NULL; self->handlers[i] = NULL;
Py_XDECREF(temp); Py_XDECREF(temp);
} }
// Pyston change: object are allocated using the GC not malloc free(self->handlers);
// free(self->handlers);
self->handlers = NULL; self->handlers = NULL;
} }
if (self->buffer != NULL) { if (self->buffer != NULL) {
...@@ -1891,8 +1886,7 @@ MODULE_INITFUNC(void) ...@@ -1891,8 +1886,7 @@ MODULE_INITFUNC(void)
/* Add some symbolic constants to the module */ /* Add some symbolic constants to the module */
if (ErrorObject == NULL) { if (ErrorObject == NULL) {
ErrorObject = PyGC_RegisterStaticConstant(PyErr_NewException("xml.parsers.expat.ExpatError", ErrorObject = PyErr_NewException("xml.parsers.expat.ExpatError", NULL, NULL);
NULL, NULL));
if (ErrorObject == NULL) if (ErrorObject == NULL)
return; return;
} }
......
# expected: reffail
# - "pyexpat.xmlparser needs a tp_traverse"
# XXX TypeErrors on calling handlers, or on bad return values from a # XXX TypeErrors on calling handlers, or on bad return values from a
# handler, are obscure and unhelpful. # handler, are obscure and unhelpful.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment