[Python-Dev] Can someone look at dummy_thread (#622537)?
Martin v. Löwis
martin@v.loewis.de
03 Dec 2002 20:55:39 +0100
Brett Cannon <bac@OCF.Berkeley.EDU> writes:
> > I don't propose to automate this. I propose this:
> >
> > try:
> > import threading
> > except ImportError:
> > import dummy_threading as threading
> >
>
> So is this an indirect request for me to write ``dumy_threading``?
I would suggest to make this
import dummy_thread as threading
i.e. have dummy_thread expose the union of the thread and threading
APIs.
> If it is it won't be hard: I would do an ``import *`` on
> ``threading``
That wont't work: "from threading import *" will raise an ImportError.
I suggest to add dummy_thread to sys.modules, then execfile
threading.py in dummy_thread, then remove it from sys.modules.
Regards,
Martin