summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 782c51b..f87d58f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4100,6 +4100,12 @@ reduce_newobj(PyObject *obj, int proto)
PyObject *newobj, *newargs, *state, *listitems, *dictitems;
PyObject *result;
+ if (Py_TYPE(obj)->tp_new == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "can't pickle %s objects",
+ Py_TYPE(obj)->tp_name);
+ return NULL;
+ }
if (_PyObject_GetNewArguments(obj, &args, &kwargs) < 0)
return NULL;