File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1090,6 +1090,10 @@ def test_getallocatedblocks(self):
10901090 # about the underlying implementation: the function might
10911091 # return 0 or something greater.
10921092 self .assertGreaterEqual (a , 0 )
1093+ gc .collect ()
1094+ b = sys .getallocatedblocks ()
1095+ self .assertLessEqual (b , a )
1096+ gc .collect ()
10931097 try :
10941098 # While we could imagine a Python session where the number of
10951099 # multiple buffer objects would exceed the sharing of references,
@@ -1101,14 +1105,10 @@ def test_getallocatedblocks(self):
11011105 # references, this can cause the total number of allocated
11021106 # blocks to exceed the total number of references.
11031107 if not support .Py_GIL_DISABLED :
1104- self .assertLess (a , sys .gettotalrefcount ())
1108+ self .assertLess (b , sys .gettotalrefcount ())
11051109 except AttributeError :
11061110 # gettotalrefcount() not available
11071111 pass
1108- gc .collect ()
1109- b = sys .getallocatedblocks ()
1110- self .assertLessEqual (b , a )
1111- gc .collect ()
11121112 c = sys .getallocatedblocks ()
11131113 self .assertIn (c , range (b - 50 , b + 50 ))
11141114
You can’t perform that action at this time.
0 commit comments