This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, pitrou, vstinner
Date 2011-04-04.21:31:37
SpamBayes Score 6.22911e-06
Marked as misclassified No
Message-id <1301952700.38.0.0566976914657.issue11765@psf.upfronthosting.co.za>
In-reply-to
Content
I wrote the assertion while dump_tracebacks_later() was implemented using SIGALRM + alarm(timeout). A simple fix for this issue is just to remove the assertion. But... I'm curious, and I would like to understand.

The problem is on the following code:

    timeout = 0.5
    pause = timeout * 2.5
    # on Windows XP, b-a gives 1.249931 after sleep(1.25)
    min_pause = pause * 0.9
    a = time.time()
    time.sleep(pause)
    b = time.time()
    faulthandler.cancel_dump_tracebacks_later()
    # Check that sleep() was not interrupted
    assert (b - a) >= min_pause, "{{}} < {{}}".format(b - a, min_pause)

So time.sleep(1.25) gives a time delta of 0.998 or 0.970 seconds. Hum, this value is close to 1.0 seconds, but not to 1.25 seconds.

I see different reasons why the assertion may fail:

 * sleep() was really interrupted (by faulthandler thread writing the tracebacks?)
 * time.time() and/or sleep() are not accurate on Windows XP
History
Date User Action Args
2011-04-04 21:31:40vstinnersetrecipients: + vstinner, belopolsky, pitrou
2011-04-04 21:31:40vstinnersetmessageid: <1301952700.38.0.0566976914657.issue11765@psf.upfronthosting.co.za>
2011-04-04 21:31:37vstinnerlinkissue11765 messages
2011-04-04 21:31:37vstinnercreate