diff options
| author | Lisa Roach <lisaroach14@gmail.com> | 2017-06-08 11:43:26 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-08 11:43:26 (GMT) |
| commit | 64505a1f6c0af4574e17e823b27ffe24eca44df5 (patch) | |
| tree | d2b40e19b44e4ab50f92440a54facc59038da4b3 /Objects/cellobject.c | |
| parent | 6cca5c8459cc439cb050010ffa762a03859d3051 (diff) | |
| download | cpython-64505a1f6c0af4574e17e823b27ffe24eca44df5.zip cpython-64505a1f6c0af4574e17e823b27ffe24eca44df5.tar.gz cpython-64505a1f6c0af4574e17e823b27ffe24eca44df5.tar.bz2 | |
bpo-30486: Allow setting cell value (#1840)
The cell_contents attribute of the cell object is now writable.
Diffstat (limited to 'Objects/cellobject.c')
| -rw-r--r-- | Objects/cellobject.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 9f4eddb..6af93b0 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -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 */ }; |
