mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Issue 12514: Use try/finally to assure that timeit restores GC when done.
This commit is contained in:
parent
ef4902af87
commit
3a081f526d
@ -191,9 +191,11 @@ class Timer:
|
||||
it = [None] * number
|
||||
gcold = gc.isenabled()
|
||||
gc.disable()
|
||||
timing = self.inner(it, self.timer)
|
||||
if gcold:
|
||||
gc.enable()
|
||||
try:
|
||||
timing = self.inner(it, self.timer)
|
||||
finally:
|
||||
if gcold:
|
||||
gc.enable()
|
||||
return timing
|
||||
|
||||
def repeat(self, repeat=default_repeat, number=default_number):
|
||||
|
@ -722,6 +722,7 @@ Chris Rebert
|
||||
Marc Recht
|
||||
John Redford
|
||||
Terry Reedy
|
||||
Gareth Rees
|
||||
Steve Reeves
|
||||
Lennart Regebro
|
||||
Ofir Reichenberg
|
||||
|
@ -39,6 +39,9 @@ Library
|
||||
|
||||
- Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.
|
||||
|
||||
- Issue #12514: Use try/finally to assure the timeit module restores garbage
|
||||
collections when it is done.
|
||||
|
||||
- Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
|
||||
given as a low fd, it gets overwritten.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user