A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-June/073556.html below:

[Python-Dev] What exception should Thread.start() raise?

[Python-Dev] What exception should Thread.start() raise? [Python-Dev] What exception should Thread.start() raise?BJörn Lindqvist bjourne at gmail.com
Mon Jun 4 21:32:14 CEST 2007
The threading module contains buggy code:

class Thread(_Verbose):
    ...
    def start(self):
        assert self.__initialized, "Thread.__init__() not called"
        assert not self.__started, "thread already started"
    ...

If you run such code with python -O, weird stuff may happen when you
call mythread.start() multiple times. -O removes assert statements so
the code won't fail with an AssertionError which would be expected.

So what real exception should Thread.start() raise? I have suggested
adding an IllegalStateError modelled after java's
IllegalStateException, but that idea was rejected. So what exception
should be raised here, is it a RuntimeError?

-- 
mvh Björn
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4