[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Aritn Sarraf
Aritn Sarraf added the comment: Understood. Thanks both, for taking the time to look. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Steven is right that this would be a behavior change. It is also out of line with Python norms where all objects are born true and have to learn to be false with either __len__ or __bool__. It is not a norm for bool(obj) to raise an exception. Followin

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Aritn Sarraf
Aritn Sarraf added the comment: Hi Steve, a couple things to preface my following comment. (1) Didn't mean to suggest that the current behavior is a bug. I don't think it is a bug, rather that it can easily lead to bugs. (2) Sorry for tagging the previous versions, I'm not familiar with the

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug fix, it is a change of behaviour ("enhancement"). All of 3.6 through 3.9 are in feature freeze. 3.10 is probably in feature freeze, but if not it is extremely close to it. So this can only go into 3.11 and (maybe) 3.10. But I don't think t

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread artin sarraf
Change by artin sarraf : -- keywords: +patch nosy: +sarf nosy_count: 1.0 -> 2.0 pull_requests: +24294 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25575 ___ Python tracker

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Aritn Sarraf
New submission from Aritn Sarraf : I'll sometimes find myself accidentally doing something like this (especially after a long break from using the threading module): ``` stop_thread = threading.Event() ... while not stop_thread: # bug - bool(stop_thread) will always evaluate to True ... `