File tree Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -512,12 +512,12 @@ static inline void _Py_INCREF(PyObject *op)
512
512
#else
513
513
// Non-limited C API and limited C API for Python 3.9 and older access
514
514
// directly PyObject.ob_refcnt.
515
- #ifdef Py_REF_DEBUG
516
- _Py_RefTotal ++ ;
517
- #endif
518
515
if (_Py_IsImmortal (op )) {
519
516
return ;
520
517
}
518
+ #ifdef Py_REF_DEBUG
519
+ _Py_RefTotal ++ ;
520
+ #endif
521
521
op -> ob_refcnt ++ ;
522
522
#endif
523
523
}
@@ -535,12 +535,12 @@ static inline void _Py_DECREF(
535
535
#else
536
536
// Non-limited C API and limited C API for Python 3.9 and older access
537
537
// directly PyObject.ob_refcnt.
538
- #ifdef Py_REF_DEBUG
539
- _Py_RefTotal -- ;
540
- #endif
541
538
if (_Py_IsImmortal (op )) {
542
539
return ;
543
540
}
541
+ #ifdef Py_REF_DEBUG
542
+ _Py_RefTotal -- ;
543
+ #endif
544
544
if (-- op -> ob_refcnt != 0 ) {
545
545
#ifdef Py_REF_DEBUG
546
546
if (op -> ob_refcnt < 0 ) {
Original file line number Diff line number Diff line change
1
+ import unittest
2
+
3
+ GLOBAL_LIST = []
4
+
5
+ class RefLeakTest (unittest .TestCase ):
6
+ def test_leak (self ):
7
+ GLOBAL_LIST .append (object ())
8
+
9
+ if __name__ == '__main__' :
10
+ unittest .main ()
Original file line number Diff line number Diff line change @@ -913,7 +913,7 @@ class RefLeakTest(unittest.TestCase):
913
913
def test_leak(self):
914
914
GLOBAL_LIST.append(object())
915
915
""" )
916
- self .check_leak (code , 'references ' )
916
+ self .check_leak (code , 'memory blocks ' )
917
917
918
918
@unittest .skipUnless (Py_DEBUG , 'need a debug build' )
919
919
def test_huntrleaks_fd_leak (self ):
Original file line number Diff line number Diff line change
1
+ import unittest
2
+
3
+ GLOBAL_LIST = []
4
+
5
+ class RefLeakTest (unittest .TestCase ):
6
+ def test_leak (self ):
7
+ GLOBAL_LIST .append (object ())
8
+
9
+ if __name__ == '__main__' :
10
+ unittest .main ()
You can’t perform that action at this time.
0 commit comments