File tree Expand file tree Collapse file tree 1 file changed +19
-16
lines changed Expand file tree Collapse file tree 1 file changed +19
-16
lines changed Original file line number Diff line number Diff line change 11import re
22import sys
3+ import textwrap
34import types
45import unittest
56import weakref
67
78from test import support
9+ from test .support .script_helper import assert_python_ok
810
911
1012class ClearTest (unittest .TestCase ):
@@ -238,25 +240,26 @@ def inner():
238240class TestIncompleteFrameAreInvisible (unittest .TestCase ):
239241
240242 def test_issue95818 (self ):
241- #See GH-95818 for details
242- import gc
243- self . addCleanup ( gc . set_threshold , * gc . get_threshold ())
243+ # See GH-95818 for details
244+ code = textwrap . dedent ( f"""
245+ import gc
244246
245- gc .set_threshold (1 ,1 ,1 )
246- class GCHello :
247- def __del__ (self ):
248- print ("Destroyed from gc" )
247+ gc.set_threshold(1,1,1)
248+ class GCHello:
249+ def __del__(self):
250+ print("Destroyed from gc")
249251
250- def gen ():
251- yield
252-
253- fd = open (__file__ )
254- l = [fd , GCHello ()]
255- l .append (l )
256- del fd
257- del l
258- gen ()
252+ def gen():
253+ yield
259254
255+ fd = open({ __file__ !r} )
256+ l = [fd, GCHello()]
257+ l.append(l)
258+ del fd
259+ del l
260+ gen()
261+ """ )
262+ assert_python_ok ("-c" , code )
260263
261264if __name__ == "__main__" :
262265 unittest .main ()
You can’t perform that action at this time.
0 commit comments