@@ -147,7 +147,7 @@ impl WeakRefList {
147147 cls_is_weakref : bool ,
148148 callback : Option < PyObjectRef > ,
149149 dict : Option < PyDictRef > ,
150- ) -> PyObjectWeak {
150+ ) -> PyRef < PyWeak > {
151151 let is_generic = cls_is_weakref && callback. is_none ( ) ;
152152 let inner_ptr = self . inner . get_or_init ( || {
153153 Box :: new ( PyMutex :: new ( WeakListInner {
@@ -250,7 +250,7 @@ impl WeakRefList {
250250 Box :: from_raw ( ptr. as_ptr ( ) ) ;
251251 }
252252
253- fn get_weak_references ( & self ) -> Vec < PyObjectWeak > {
253+ fn get_weak_references ( & self ) -> Vec < PyRef < PyWeak > > {
254254 let inner = match self . try_lock ( ) {
255255 Some ( inner) => inner,
256256 None => return vec ! [ ] ,
@@ -361,9 +361,7 @@ impl Drop for PyWeak {
361361 }
362362}
363363
364- pub type PyObjectWeak = PyRef < PyWeak > ;
365-
366- impl PyObjectWeak {
364+ impl PyRef < PyWeak > {
367365 #[ inline( always) ]
368366 pub fn upgrade ( & self ) -> Option < PyObjectRef > {
369367 PyWeak :: upgrade ( self )
@@ -562,7 +560,7 @@ impl PyObject {
562560 callback : Option < PyObjectRef > ,
563561 // a reference to weakref_type **specifically**
564562 typ : PyTypeRef ,
565- ) -> Option < PyObjectWeak > {
563+ ) -> Option < PyRef < PyWeak > > {
566564 self . weak_ref_list ( )
567565 . map ( |wrl| wrl. add ( self , typ, true , callback, None ) )
568566 }
@@ -572,7 +570,7 @@ impl PyObject {
572570 callback : Option < PyObjectRef > ,
573571 typ : PyTypeRef ,
574572 vm : & VirtualMachine ,
575- ) -> PyResult < PyObjectWeak > {
573+ ) -> PyResult < PyRef < PyWeak > > {
576574 let dict = if typ
577575 . slots
578576 . flags
@@ -597,11 +595,11 @@ impl PyObject {
597595 & self ,
598596 callback : Option < PyObjectRef > ,
599597 vm : & VirtualMachine ,
600- ) -> PyResult < PyObjectWeak > {
598+ ) -> PyResult < PyRef < PyWeak > > {
601599 self . downgrade_with_typ ( callback, vm. ctx . types . weakref_type . clone ( ) , vm)
602600 }
603601
604- pub fn get_weak_references ( & self ) -> Option < Vec < PyObjectWeak > > {
602+ pub fn get_weak_references ( & self ) -> Option < Vec < PyRef < PyWeak > > > {
605603 self . weak_ref_list ( ) . map ( |wrl| wrl. get_weak_references ( ) )
606604 }
607605
@@ -1006,7 +1004,7 @@ where
10061004
10071005#[ repr( transparent) ]
10081006pub struct PyWeakRef < T : PyObjectPayload > {
1009- weak : PyObjectWeak ,
1007+ weak : PyRef < PyWeak > ,
10101008 _marker : PhantomData < T > ,
10111009}
10121010
0 commit comments