[issue36666] threading.Thread should have way to catch an exception thrown within

2020-09-22 Thread STINNER Victor
STINNER Victor added the comment: I consider that this issue as a duplicate of bpo-1230540. Python 3.8 has a new threading.excepthook hook which can be used in various ways to decide how to handle uncatched thread exceptions. https://docs.python.org/dev/library/threading.html#threading.excep

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Joel Croteau
Joel Croteau added the comment: I'm kind of in agreement with Mark on this, actually. I came across this problem when examining some threaded code that was clearly not working as intended, but was reporting success. Figuring out why that was was not easy. The code had been hastily ported to

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding
Mark Borgerding added the comment: I'm not trying to disrespect anyone: not users nor certainly Python developers. I have loved Python since I learned it in 2001. I was merely trying to respond to what seemed like an automatic rejection of changing legacy behavior. I certainly agree chang

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'd argue such code deserves to be broken That argument falls flat with me and it doesn't show respect for our users. The proposal would be a major change to the "rules of the game" and would likely require discussion and buy-in on python-dev and perha

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread pmp-p
Change by pmp-p : -- nosy: +pmpp ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mail

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding
Mark Borgerding added the comment: @pitrou I don't necessarily agree that "current behavior can't be changed". One major selling point of exceptions is that they cannot be accidentally ignored. The exception is how the current threading.Thread ignores them. You are correct that changing Th

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-19 Thread Joel Croteau
Joel Croteau added the comment: Yes, I know there are workarounds for it, I have seen many, and everyone seems to have their own version. I'm saying we shouldn't need workarounds though–this should be built in functionality. Ideally, dropping an exception should never be default behavior, but

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-19 Thread Eric Snow
Eric Snow added the comment: Here's a basic decorator along those lines, similar to one that I've used on occasion: def as_thread(target): def _target(): try: t.result = target() except Exception as exc: t.failure = exc

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-19 Thread Joel Croteau
Joel Croteau added the comment: I agree that we should not change the default behavior of Thread.join(), as that would break existing code, but there are plenty of other ways to do this. I see a couple of possibilities: 1. Add an option to the Thread constructor, something like raise_exc, th

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: The current behavior can't be changed for compatibility reasons (imagine user programs starting to raise on Thread.join()), but we could add an option to the threading.Thread() constructor in order to store and propagate exceptions. -- nosy: +giampao

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-19 Thread Antoine Pitrou
Change by Antoine Pitrou : -- nosy: +tim.peters type: -> enhancement versions: +Python 3.8 -Python 3.7 ___ Python tracker ___ ___ P

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-04-18 Thread Joel Croteau
New submission from Joel Croteau : This has been commented on numerous times by others (https://stackoverflow.com/questions/2829329/catch-a-threads-exception-in-the-caller-thread-in-python, http://benno.id.au/blog/2012/10/06/python-thread-exceptions, to name a few), but there is no in-built m