summaryrefslogtreecommitdiffstats
path: root/Objects/cellobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/cellobject.c')
-rw-r--r--Objects/cellobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index 6794ff3..4984366 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -77,7 +77,12 @@ cell_clear(PyCellObject *op)
static PyObject *
cell_get_contents(PyCellObject *op, void *closure)
{
- Py_XINCREF(op->ob_ref);
+ if (op->ob_ref == NULL)
+ {
+ PyErr_SetString(PyExc_ValueError, "Cell is empty");
+ return NULL;
+ }
+ Py_INCREF(op->ob_ref);
return op->ob_ref;
}