STINNER Victor <victor.stin...@haypocalc.com> added the comment:

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

----------
nosy: +belopolsky

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to