mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #1445: Fix a SystemError when accessing the `cell_contents`
attribute of an empty cell object. Now a ValueError is raised.
This commit is contained in:
parent
6dae85f409
commit
ce7d10ccc4
3 changed files with 21 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue