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
d906ea62
Kaydet (Commit)
d906ea62
authored
Mar 31, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix Thread.ident when it is the main thread or a dummy thread #5632
üst
a08e8ded
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
test_threading.py
Lib/test/test_threading.py
+13
-0
threading.py
Lib/threading.py
+6
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_threading.py
Dosyayı görüntüle @
d906ea62
...
@@ -83,11 +83,24 @@ class ThreadTests(unittest.TestCase):
...
@@ -83,11 +83,24 @@ class ThreadTests(unittest.TestCase):
t
.
join
(
NUMTASKS
)
t
.
join
(
NUMTASKS
)
self
.
assert_
(
not
t
.
is_alive
())
self
.
assert_
(
not
t
.
is_alive
())
self
.
failIfEqual
(
t
.
ident
,
0
)
self
.
failIfEqual
(
t
.
ident
,
0
)
self
.
assertFalse
(
t
.
ident
is
None
)
self
.
assert_
(
re
.
match
(
'<TestThread
\
(.*,
\
w+ -?
\
d+
\
)>'
,
repr
(
t
)))
self
.
assert_
(
re
.
match
(
'<TestThread
\
(.*,
\
w+ -?
\
d+
\
)>'
,
repr
(
t
)))
if
verbose
:
if
verbose
:
print
'all tasks done'
print
'all tasks done'
self
.
assertEqual
(
numrunning
.
get
(),
0
)
self
.
assertEqual
(
numrunning
.
get
(),
0
)
def
test_ident_of_no_threading_threads
(
self
):
# The ident still must work for the main thread and dummy threads.
self
.
assertFalse
(
threading
.
currentThread
()
.
ident
is
None
)
def
f
():
ident
.
append
(
threading
.
currentThread
()
.
ident
)
done
.
set
()
done
=
threading
.
Event
()
ident
=
[]
thread
.
start_new_thread
(
f
,
())
done
.
wait
()
self
.
assertFalse
(
ident
[
0
]
is
None
)
# run with a small(ish) thread stack size (256kB)
# run with a small(ish) thread stack size (256kB)
def
test_various_ops_small_stack
(
self
):
def
test_various_ops_small_stack
(
self
):
if
verbose
:
if
verbose
:
...
...
Lib/threading.py
Dosyayı görüntüle @
d906ea62
...
@@ -500,9 +500,12 @@ class Thread(_Verbose):
...
@@ -500,9 +500,12 @@ class Thread(_Verbose):
return
return
raise
raise
def
_set_ident
(
self
):
self
.
__ident
=
_get_ident
()
def
__bootstrap_inner
(
self
):
def
__bootstrap_inner
(
self
):
try
:
try
:
self
.
_
_ident
=
_g
et_ident
()
self
.
_
s
et_ident
()
self
.
__started
.
set
()
self
.
__started
.
set
()
with
_active_limbo_lock
:
with
_active_limbo_lock
:
_active
[
self
.
__ident
]
=
self
_active
[
self
.
__ident
]
=
self
...
@@ -733,6 +736,7 @@ class _MainThread(Thread):
...
@@ -733,6 +736,7 @@ class _MainThread(Thread):
def
__init__
(
self
):
def
__init__
(
self
):
Thread
.
__init__
(
self
,
name
=
"MainThread"
)
Thread
.
__init__
(
self
,
name
=
"MainThread"
)
self
.
_Thread__started
.
set
()
self
.
_Thread__started
.
set
()
self
.
_set_ident
()
with
_active_limbo_lock
:
with
_active_limbo_lock
:
_active
[
_get_ident
()]
=
self
_active
[
_get_ident
()]
=
self
...
@@ -778,6 +782,7 @@ class _DummyThread(Thread):
...
@@ -778,6 +782,7 @@ class _DummyThread(Thread):
del
self
.
_Thread__block
del
self
.
_Thread__block
self
.
_Thread__started
.
set
()
self
.
_Thread__started
.
set
()
self
.
_set_ident
()
with
_active_limbo_lock
:
with
_active_limbo_lock
:
_active
[
_get_ident
()]
=
self
_active
[
_get_ident
()]
=
self
...
...
Misc/NEWS
Dosyayı görüntüle @
d906ea62
...
@@ -199,6 +199,9 @@ Core and Builtins
...
@@ -199,6 +199,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #5632: Thread.ident was None for the main thread and threads not created
with the threading module.
- Issue #5400: Added patch for multiprocessing on netbsd compilation/support
- Issue #5400: Added patch for multiprocessing on netbsd compilation/support
- Issue #5387: Fixed mmap.move crash by integer overflow.
- Issue #5387: Fixed mmap.move crash by integer overflow.
...
...
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