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

Guido van Rossum guido@python.org
Tue, 03 Dec 2002 07:07:53 -0500


> > >     try:
> > >         import threading
> > >     except ImportError:
> > >         threading = None # use non-threaded behaviour
> > 
> > But then you'd have to sprinkle the rest of the code with
> > "if threading is not None" tests.  Brett's dummy_thread is an attempt
> > to reduce this clutter.
> 
> the problem (if there is one) is that the proposed integration may
> break code that uses the above pattern.

I don't propose to automate this.  I propose this:

  try:
    import threading
  except ImportError:
    import dummy_threading as threading

> deadlocks doesn't always happen when you want them to, so it
> may not be obvious to developers and testers that their program
> isn't as reliable as it was before the upgrade.

So require testing on a system that has threads.

--Guido van Rossum (home page: http://www.python.org/~guido/)