Skip to content

Commit 323c040

Browse files
committed
Fix cell_contents
1 parent 5d68313 commit 323c040

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/test/test_funcattrs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ def f(): print(a)
140140
self.fail("shouldn't be able to read an empty cell")
141141
a = 12
142142

143-
# TODO: RUSTPYTHON
144-
@unittest.expectedFailure
145143
def test_set_cell(self):
146144
a = 12
147145
def f(): return a

vm/src/builtins/function.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,11 @@ impl PyCell {
759759
.ok_or_else(|| vm.new_value_error("Cell is empty".to_owned()))
760760
}
761761
#[pygetset(setter)]
762-
fn set_cell_contents(&self, x: PyObjectRef) {
763-
self.set(Some(x))
762+
fn set_cell_contents(&self, x: PySetterValue) {
763+
match x {
764+
PySetterValue::Assign(value) => self.set(Some(value)),
765+
PySetterValue::Delete => self.set(None),
766+
}
764767
}
765768
}
766769

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy