weakref: treat explicit None callback as no callback (#8298)

This commit is contained in:
김은빈 authored and GitHub committed 2026-07-17 02:51:36 +00:00
1 parent e7be076162
commit 1205fd2468
2 files changed
+1 -2

No files matched your search

-1
View File
@@ -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)
+1 -1
View File
@@ -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(