[Python-Dev] Can someone look at dummy_thread (#622537)?

Fredrik Lundh fredrik@pythonware.com
Tue, 3 Dec 2002 20:24:31 +0100


Brett Cannon wrote:
> 
> > > > >     try:
> > > > >         import threading
> > > > >     except ImportError:
> > > > >         threading = None # use non-threaded behaviour

> But if it does it will be on platforms it couldn't run on previously.

Sigh.  Let's try one more time:

Under 2.2 and earlier, on a platform that doesn't support threads,
the above code will set threading to None, and the application can
then use "if threading is None" to provide application-specific work-
arounds.

(catching import errors is a very common pattern when you're writing
portable Python code).

If you change Python so that "import threading" succeeds also on plat-
forms that don't support threads, the application-specific workarounds
will no longer be used, and the application may no longer work properly.

And since we're talking deadlocks, chances are that nobody will notice
before it's too late.

</F>