mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-30486: Allow setting cell value (#1840)
The cell_contents attribute of the cell object is now writable.
This commit is contained in:
parent
6cca5c8459
commit
64505a1f6c
4 changed files with 41 additions and 4 deletions
|
@ -140,8 +140,17 @@ cell_get_contents(PyCellObject *op, void *closure)
|
|||
return op->ob_ref;
|
||||
}
|
||||
|
||||
int
|
||||
cell_set_contents(PyCellObject *op, PyObject *obj)
|
||||
{
|
||||
Py_XINCREF(obj);
|
||||
Py_XSETREF(op->ob_ref, obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyGetSetDef cell_getsetlist[] = {
|
||||
{"cell_contents", (getter)cell_get_contents, NULL},
|
||||
{"cell_contents", (getter)cell_get_contents,
|
||||
(setter)cell_set_contents, NULL},
|
||||
{NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue