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.

classification
Title: scheduler.empty() in module sched appears broken
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: georg.brandl, rhettinger, theshtat
Priority: normal Keywords:

Created on 2007-03-08 08:50 by theshtat, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg31468 - (view) Author: Mark (theshtat) Date: 2007-03-08 08:50
In:
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) 
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin

The sched.scheduler.empty() method appears to be broken.  Its implementation is:
  return not not self.queue
Which returns true when the event queue is *not* empty.
http://www.google.com/codesearch?hl=en&q=+file:sched.py+%22not+not%22+show:_EUH1sHctjI:SV8rbKB68UQ:wZlnTyplW4c&sa=N&cd=1&ct=rc&cs_p=http://svn.python.org/snapshots/python25.tar.bz2&cs_f=python/Lib/sched.py#a0

Other Python builds seem to have a correct implementation:
http://www.google.com/codesearch?hl=en&q=+file:sched.py+%22len(self.queue)%22+show:tKxWDv9S6Xg:d-f-3CzYpHc:iU9xQ6L5s1s&sa=N&cd=1&ct=rc&cs_p=http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2&cs_f=Python-2.4.3/Lib/sched.py#a0

Thanks,
Mark
mayzenshtat at) gmail (dot com
msg31469 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-08 18:24
This was your change, Raymond.
msg31470 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-03-08 19:25
Fixed in revs 54224 and 54225.
Thanks for the bug report.
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44682
2007-03-08 08:50:00theshtatcreate