@@ -318,7 +318,7 @@ impl PyWeak {
318
318
let guard = unsafe { self . parent . as_ref ( ) . lock ( ) } ;
319
319
let obj_ptr = guard. obj ?;
320
320
unsafe {
321
- obj_ptr. as_ref ( ) . 0 . refcount . incref ( ) ;
321
+ obj_ptr. as_ref ( ) . 0 . refcount . inc ( ) ;
322
322
Some ( PyObjectRef :: from_raw ( obj_ptr. as_ptr ( ) ) )
323
323
}
324
324
}
@@ -464,7 +464,7 @@ impl ToOwned for PyObject {
464
464
465
465
#[ inline( always) ]
466
466
fn to_owned ( & self ) -> Self :: Owned {
467
- self . 0 . refcount . incref ( ) ;
467
+ self . 0 . refcount . inc ( ) ;
468
468
PyObjectRef {
469
469
ptr : NonNull :: from ( self ) ,
470
470
}
@@ -569,7 +569,7 @@ impl PyObjectRef {
569
569
570
570
impl PyObject {
571
571
#[ inline]
572
- fn weakreflist ( & self ) -> Option < & WeakRefList > {
572
+ fn weak_ref_list ( & self ) -> Option < & WeakRefList > {
573
573
Some ( & self . 0 . weaklist )
574
574
}
575
575
@@ -579,8 +579,8 @@ impl PyObject {
579
579
// a reference to weakref_type **specifically**
580
580
typ : PyTypeRef ,
581
581
) -> Option < PyObjectWeak > {
582
- self . weakreflist ( )
583
- . map ( |wr| wr . add ( self , typ, true , callback, None ) )
582
+ self . weak_ref_list ( )
583
+ . map ( |wrl| wrl . add ( self , typ, true , callback, None ) )
584
584
}
585
585
586
586
pub ( crate ) fn downgrade_with_typ (
@@ -599,8 +599,8 @@ impl PyObject {
599
599
None
600
600
} ;
601
601
let cls_is_weakref = typ. is ( & vm. ctx . types . weakref_type ) ;
602
- self . weakreflist ( )
603
- . map ( |wr| wr . add ( self , typ, cls_is_weakref, callback, dict) )
602
+ self . weak_ref_list ( )
603
+ . map ( |wrl| wrl . add ( self , typ, cls_is_weakref, callback, dict) )
604
604
. ok_or_else ( || {
605
605
vm. new_type_error ( format ! (
606
606
"cannot create weak reference to '{}' object" ,
@@ -618,7 +618,7 @@ impl PyObject {
618
618
}
619
619
620
620
pub fn get_weak_references ( & self ) -> Option < Vec < PyObjectWeak > > {
621
- self . weakreflist ( ) . map ( |wrl| wrl. get_weak_references ( ) )
621
+ self . weak_ref_list ( ) . map ( |wrl| wrl. get_weak_references ( ) )
622
622
}
623
623
624
624
pub fn payload_is < T : PyObjectPayload > ( & self ) -> bool {
@@ -705,7 +705,7 @@ impl PyObject {
705
705
706
706
#[ inline]
707
707
pub fn weak_count ( & self ) -> Option < usize > {
708
- self . weakreflist ( ) . map ( |wrl| wrl. count ( ) )
708
+ self . weak_ref_list ( ) . map ( |wrl| wrl. count ( ) )
709
709
}
710
710
711
711
#[ inline]
@@ -721,11 +721,11 @@ impl PyObjectRef {
721
721
// CPython-compatible drop implementation
722
722
if let Some ( slot_del) = self . class ( ) . mro_find_map ( |cls| cls. slots . del . load ( ) ) {
723
723
let ret = crate :: vm:: thread:: with_vm ( self , |vm| {
724
- self . 0 . refcount . incref ( ) ;
724
+ self . 0 . refcount . inc ( ) ;
725
725
if let Err ( e) = slot_del ( self , vm) {
726
726
print_del_error ( e, self , vm) ;
727
727
}
728
- self . 0 . refcount . decref ( )
728
+ self . 0 . refcount . dec ( )
729
729
} ) ;
730
730
match ret {
731
731
// the decref right above set refcount back to 0
@@ -737,7 +737,7 @@ impl PyObjectRef {
737
737
}
738
738
}
739
739
}
740
- if let Some ( wrl) = self . weakreflist ( ) {
740
+ if let Some ( wrl) = self . weak_ref_list ( ) {
741
741
wrl. clear ( ) ;
742
742
}
743
743
@@ -804,7 +804,7 @@ impl PyObjectWeak {
804
804
805
805
impl Drop for PyObjectRef {
806
806
fn drop ( & mut self ) {
807
- if self . 0 . refcount . decref ( ) {
807
+ if self . 0 . refcount . dec ( ) {
808
808
self . drop_slow ( )
809
809
}
810
810
}
@@ -1093,12 +1093,12 @@ pub(crate) fn init_type_hierarchy() -> (PyTypeRef, PyTypeRef, PyTypeRef) {
1093
1093
type_type_ptr as * mut MaybeUninit < PyInner < PyType > > as * mut PyInner < PyType > ;
1094
1094
1095
1095
unsafe {
1096
- ( * type_type_ptr) . refcount . incref ( ) ;
1096
+ ( * type_type_ptr) . refcount . inc ( ) ;
1097
1097
ptr:: write (
1098
1098
& mut ( * object_type_ptr) . typ as * mut PyRwLock < PyTypeRef > as * mut UninitRef < PyType > ,
1099
1099
PyRwLock :: new ( NonNull :: new_unchecked ( type_type_ptr) ) ,
1100
1100
) ;
1101
- ( * type_type_ptr) . refcount . incref ( ) ;
1101
+ ( * type_type_ptr) . refcount . inc ( ) ;
1102
1102
ptr:: write (
1103
1103
& mut ( * type_type_ptr) . typ as * mut PyRwLock < PyTypeRef > as * mut UninitRef < PyType > ,
1104
1104
PyRwLock :: new ( NonNull :: new_unchecked ( type_type_ptr) ) ,
0 commit comments