summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-24 13:44:17 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-24 13:44:17 (GMT)
commitce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8 (patch)
tree0f13ca75cbdaac1c1c2e712f47055cd7f66a8bca /Objects
parent6dae85f409642f29ff37c8648f977ea24883e75e (diff)
downloadcpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.zip
cpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.tar.gz
cpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.tar.bz2
Issue #1445: Fix a SystemError when accessing the ``cell_contents``
attribute of an empty cell object. Now a ValueError is raised.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/cellobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index 63322c1..dc684d5 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -89,7 +89,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;
}