mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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:
parent
9bce311ea4
commit
0cdd4454f3
3 changed files with 15 additions and 34 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue