Skip to content
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
markshannon committed Jun 28, 2022
commit b69e8034d9ee549f5b7816b38056400b64dc6e92
8 changes: 6 additions & 2 deletions Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def gen():
yield 1

thresholds = gc.get_threshold()

gc.callbacks.append(cb)
gc.set_threshold(1, 0, 0)
try:
Expand All @@ -197,11 +198,14 @@ def __del__(self):
sneaky = Sneaky()
sneaky._s = Sneaky()
sneaky._s._s = sneaky
del sneaky

gc.set_threshold(1, 0, 0)
try:
gen()
del sneaky
try:
gen()
except KeyboardInterrupt:
pass
finally:
gc.set_threshold(*thresholds)

Expand Down