Remove indirection in threading (issue #10968).

The public names (Thread, Condition, etc.) used to be factory functions
returning instances of hidden classes (_Thread, _Condition, etc.),
because (if Guido recalls correctly) this code pre-dates the ability to
subclass extension types.

It is now possible to inherit from Thread and other classes, without
having to import the private underscored names like multiprocessing did.

A doc update will follow: a patch is under discussion on the issue.
This commit is contained in:
Éric Araujo 2011-07-28 00:28:28 +02:00
parent 9bce311ea4
commit 0cdd4454f3
3 changed files with 15 additions and 34 deletions

View file

@ -51,7 +51,7 @@ import itertools
from multiprocessing import TimeoutError, cpu_count
from multiprocessing.dummy.connection import Pipe
from threading import Lock, RLock, Semaphore, BoundedSemaphore
from threading import Event
from threading import Event, Condition
from queue import Queue
#
@ -84,17 +84,6 @@ class DummyProcess(threading.Thread):
#
#
class Condition(threading._Condition):
# XXX
if sys.version_info < (3, 0):
notify_all = threading._Condition.notify_all.__func__
else:
notify_all = threading._Condition.notify_all
#
#
#
Process = DummyProcess
current_process = threading.current_thread
current_process()._children = weakref.WeakKeyDictionary()