mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
weakref: treat explicit None callback as no callback (#8298)
This commit is contained in:
1 parent
125f3ae323
commit
abc35e5f83
2 files changed
+1
-2
No files matched your search
Vendored
-1
@@ -380,7 +380,6 @@ class ReferencesTestCase(TestBase):
|
||||
# was not honored, and was broken in different ways for
|
||||
# PyWeakref_NewRef() and PyWeakref_NewProxy(). (Two tests.)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
def test_shared_ref_without_callback(self):
|
||||
self.check_shared_without_callback(weakref.ref)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ impl Constructor for PyWeak {
|
||||
let referent = positional
|
||||
.next()
|
||||
.ok_or_else(|| vm.new_type_error("__new__ expected at least 1 argument, got 0"))?;
|
||||
let callback = positional.next();
|
||||
let callback = positional.next().filter(|callback| !vm.is_none(callback));
|
||||
if let Some(_extra) = positional.next() {
|
||||
let got = positional.count() + 3;
|
||||
return Err(
|
||||
|
||||
Reference in new issue
Block a user