diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-24 13:44:17 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2007-11-24 13:44:17 (GMT) |
commit | ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8 (patch) | |
tree | 0f13ca75cbdaac1c1c2e712f47055cd7f66a8bca /Objects | |
parent | 6dae85f409642f29ff37c8648f977ea24883e75e (diff) | |
download | cpython-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.c | 7 |
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; } |