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
6ee1a31e
Kaydet (Commit)
6ee1a31e
authored
Agu 18, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add py3k warnings for old threading APIs
they will still live in 3.0 but it can't hurt
üst
351ffb80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
test_py3kwarn.py
Lib/test/test_py3kwarn.py
+34
-0
threading.py
Lib/threading.py
+11
-1
No files found.
Lib/test/test_py3kwarn.py
Dosyayı görüntüle @
6ee1a31e
...
...
@@ -250,6 +250,40 @@ class TestPy3KWarnings(unittest.TestCase):
def
__hash__
(
self
):
pass
self
.
assertEqual
(
len
(
w
.
warnings
),
0
)
def
test_pep8ified_threading
(
self
):
import
threading
t
=
threading
.
Thread
()
with
catch_warning
()
as
w
:
msg
=
"isDaemon() is deprecated in favor of the "
\
"Thread.daemon property"
self
.
assertWarning
(
t
.
isDaemon
(),
w
,
msg
)
w
.
reset
()
msg
=
"setDaemon() is deprecated in favor of the "
\
"Thread.daemon property"
self
.
assertWarning
(
t
.
setDaemon
(
True
),
w
,
msg
)
w
.
reset
()
msg
=
"getName() is deprecated in favor of the "
\
"Thread.name property"
self
.
assertWarning
(
t
.
getName
(),
w
,
msg
)
w
.
reset
()
msg
=
"setName() is deprecated in favor of the "
\
"Thread.name property"
self
.
assertWarning
(
t
.
setName
(
"name"
),
w
,
msg
)
w
.
reset
()
msg
=
"isAlive() is deprecated in favor of is_alive()"
self
.
assertWarning
(
t
.
isAlive
(),
w
,
msg
)
w
.
reset
()
e
=
threading
.
Event
()
msg
=
"isSet() is deprecated in favor of is_set()"
self
.
assertWarning
(
e
.
isSet
(),
w
,
msg
)
w
.
reset
()
msg
=
"currentThread() is deprecated in favor of current_thread()"
self
.
assertWarning
(
threading
.
currentThread
(),
w
,
msg
)
w
.
reset
()
msg
=
"activeCount() is deprecated in favor of active_count()"
self
.
assertWarning
(
threading
.
activeCount
(),
w
,
msg
)
class
TestStdlibRemovals
(
unittest
.
TestCase
):
...
...
Lib/threading.py
Dosyayı görüntüle @
6ee1a31e
...
...
@@ -39,7 +39,7 @@ def _old_api(callable, old_name):
return
callable
@wraps
(
callable
)
def
old
(
*
args
,
**
kwargs
):
warnings
.
warnpy3k
(
"
In 3.x, {0} is renamed to {1}.
"
warnings
.
warnpy3k
(
"
{0}() is deprecated in favor of {1}()
"
.
format
(
old_name
,
callable
.
__name__
),
stacklevel
=
3
)
return
callable
(
*
args
,
**
kwargs
)
...
...
@@ -670,6 +670,8 @@ class Thread(_Verbose):
assert
self
.
__initialized
,
"Thread.__init__() not called"
return
self
.
__started
.
is_set
()
and
not
self
.
__stopped
isAlive
=
_old_api
(
is_alive
,
"isAlive"
)
@property
def
daemon
(
self
):
assert
self
.
__initialized
,
"Thread.__init__() not called"
...
...
@@ -684,15 +686,23 @@ class Thread(_Verbose):
self
.
__daemonic
=
daemonic
def
isDaemon
(
self
):
warnings
.
warnpy3k
(
"isDaemon() is deprecated in favor of the "
\
"Thread.daemon property"
)
return
self
.
daemon
def
setDaemon
(
self
,
daemonic
):
warnings
.
warnpy3k
(
"setDaemon() is deprecated in favor of the "
\
"Thread.daemon property"
)
self
.
daemon
=
daemonic
def
getName
(
self
):
warnings
.
warnpy3k
(
"getName() is deprecated in favor of the "
\
"Thread.name property"
)
return
self
.
name
def
setName
(
self
,
name
):
warnings
.
warnpy3k
(
"setName() is deprecated in favor of the "
\
"Thread.name property"
)
self
.
name
=
name
# The timer class was contributed by Itamar Shtull-Trauring
...
...
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