Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6f75c873
Unverified
Kaydet (Commit)
6f75c873
authored
Haz 13, 2019
tarafından
Victor Stinner
Kaydeden (comit)
GitHub
Haz 13, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tbpo-36402: Fix threading.Thread._stop() (GH-14047)
Remove the _tstate_lock from _shutdown_locks, don't remove None.
üst
b4b814b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
test_threading.py
Lib/test/test_threading.py
+24
-0
threading.py
Lib/threading.py
+1
-1
No files found.
Lib/test/test_threading.py
Dosyayı görüntüle @
6f75c873
...
...
@@ -738,6 +738,30 @@ class ThreadTests(BaseTestCase):
finally
:
sys
.
settrace
(
old_trace
)
@cpython_only
def
test_shutdown_locks
(
self
):
for
daemon
in
(
False
,
True
):
with
self
.
subTest
(
daemon
=
daemon
):
event
=
threading
.
Event
()
thread
=
threading
.
Thread
(
target
=
event
.
wait
,
daemon
=
daemon
)
# Thread.start() must add lock to _shutdown_locks,
# but only for non-daemon thread
thread
.
start
()
tstate_lock
=
thread
.
_tstate_lock
if
not
daemon
:
self
.
assertIn
(
tstate_lock
,
threading
.
_shutdown_locks
)
else
:
self
.
assertNotIn
(
tstate_lock
,
threading
.
_shutdown_locks
)
# unblock the thread and join it
event
.
set
()
thread
.
join
()
# Thread._stop() must remove tstate_lock from _shutdown_locks.
# Daemon threads must never add it to _shutdown_locks.
self
.
assertNotIn
(
tstate_lock
,
threading
.
_shutdown_locks
)
class
ThreadJoinOnShutdown
(
BaseTestCase
):
...
...
Lib/threading.py
Dosyayı görüntüle @
6f75c873
...
...
@@ -965,7 +965,7 @@ class Thread:
self
.
_tstate_lock
=
None
if
not
self
.
daemon
:
with
_shutdown_locks_lock
:
_shutdown_locks
.
discard
(
self
.
_tstate_
lock
)
_shutdown_locks
.
discard
(
lock
)
def
_delete
(
self
):
"Remove current thread from the dict of currently running threads."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment