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 ...@@ -249,7 +249,7 @@ PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno) PYSTON
/* Function to create a new exception */ /* Function to create a new exception */
PyAPI_FUNC(PyObject *) PyErr_NewException( 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( PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
char *name, char *doc, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT; char *name, char *doc, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *) PYSTON_NOEXCEPT;
......
...@@ -551,7 +551,7 @@ PyErr_Format(PyObject *exception, const char *format, ...) ...@@ -551,7 +551,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
PyObject * PyObject *
PyErr_NewException(char *name, PyObject *base, PyObject *dict) PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
{ {
char *dot; char *dot;
PyObject *modulename = NULL; PyObject *modulename = NULL;
......
...@@ -244,11 +244,7 @@ void setupThread() { ...@@ -244,11 +244,7 @@ void setupThread() {
thread_lock_cls->giveAttr("locked_lock", thread_lock_cls->getattr(internStringMortal("locked"))); thread_lock_cls->giveAttr("locked_lock", thread_lock_cls->getattr(internStringMortal("locked")));
thread_lock_cls->freeze(); thread_lock_cls->freeze();
ThreadError = BoxedClass::create(type_cls, Exception, NULL, Exception->attrs_offset, Exception->tp_weaklistoffset, ThreadError = (BoxedClass*)PyErr_NewException("thread.error", NULL, NULL);
Exception->tp_basicsize, false, "error");
ThreadError->giveAttr("__module__", boxString("thread"));
ThreadError->freeze();
thread_module->giveAttr("error", ThreadError); 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] ...@@ -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 import cStringIO
StringIO = cPickle.loads(cPickle.dumps(cStringIO.StringIO)) StringIO = cPickle.loads(cPickle.dumps(cStringIO.StringIO))
print type(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