merge heads

This commit is contained in:
Benjamin Peterson 2011-06-29 22:53:19 -05:00
commit 844315c751
1 changed files with 13 additions and 10 deletions

View File

@ -18,16 +18,19 @@ class CProfileTest(ProfileTest):
def test_bad_counter_during_dealloc(self):
import _lsprof
# Must use a file as StringIO doesn't trigger the bug.
with open(TESTFN, 'w') as file:
sys.stderr = file
try:
obj = _lsprof.Profiler(lambda: int)
obj.enable()
obj = _lsprof.Profiler(1)
obj.disable()
finally:
sys.stderr = sys.__stderr__
unlink(TESTFN)
orig_stderr = sys.stderr
try:
with open(TESTFN, 'w') as file:
sys.stderr = file
try:
obj = _lsprof.Profiler(lambda: int)
obj.enable()
obj = _lsprof.Profiler(1)
obj.disable()
finally:
sys.stderr = orig_stderr
finally:
unlink(TESTFN)
def test_main():