Commit 1904ef84 authored by Marius Wachtler's avatar Marius Wachtler

fix thread.error pickling

this caused problems inside the multiprocessing module
parent 9b30997a
......@@ -249,7 +249,7 @@ PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno) PYSTON
/* Function to create a new exception */
PyAPI_FUNC(PyObject *) PyErr_NewException(
char *name, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
const char *name, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
char *name, char *doc, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *) PYSTON_NOEXCEPT;
......
......@@ -551,7 +551,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
PyObject *
PyErr_NewException(char *name, PyObject *base, PyObject *dict)
PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
{
char *dot;
PyObject *modulename = NULL;
......
......@@ -244,11 +244,7 @@ void setupThread() {
thread_lock_cls->giveAttr("locked_lock", thread_lock_cls->getattr(internStringMortal("locked")));
thread_lock_cls->freeze();
ThreadError = BoxedClass::create(type_cls, Exception, NULL, Exception->attrs_offset, Exception->tp_weaklistoffset,
Exception->tp_basicsize, false, "error");
ThreadError->giveAttr("__module__", boxString("thread"));
ThreadError->freeze();
ThreadError = (BoxedClass*)PyErr_NewException("thread.error", NULL, NULL);
thread_module->giveAttr("error", ThreadError);
}
}
......@@ -46,3 +46,6 @@ for obj in [(1, 2), "hello world", u"hola world", 1.0, 1j, 1L, 2, {1:2}, set([3]
import cStringIO
StringIO = cPickle.loads(cPickle.dumps(cStringIO.StringIO))
print type(StringIO())
import thread
print cPickle.loads(cPickle.dumps(thread.error))
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