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
91943460
Kaydet (Commit)
91943460
authored
Eyl 21, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #22423: Unhandled exception in thread no longer causes unhandled
AttributeError when sys.stderr is None.
üst
3e46d7cb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
3 deletions
+86
-3
test_threading.py
Lib/test/test_threading.py
+79
-0
threading.py
Lib/threading.py
+3
-3
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/test/test_threading.py
Dosyayı görüntüle @
91943460
...
...
@@ -829,6 +829,85 @@ class ThreadingExceptionTests(BaseTestCase):
thread
.
start
()
self
.
assertRaises
(
RuntimeError
,
setattr
,
thread
,
"daemon"
,
True
)
def
test_print_exception
(
self
):
script
=
r"""if 1:
import threading
import time
running = False
def run():
global running
running = True
while running:
time.sleep(0.01)
1/0
t = threading.Thread(target=run)
t.start()
while not running:
time.sleep(0.01)
running = False
t.join()
"""
rc
,
out
,
err
=
assert_python_ok
(
"-c"
,
script
)
self
.
assertEqual
(
out
,
''
)
self
.
assertIn
(
"Exception in thread"
,
err
)
self
.
assertIn
(
"Traceback (most recent call last):"
,
err
)
self
.
assertIn
(
"ZeroDivisionError"
,
err
)
self
.
assertNotIn
(
"Unhandled exception"
,
err
)
def
test_print_exception_stderr_is_none_1
(
self
):
script
=
r"""if 1:
import sys
import threading
import time
running = False
def run():
global running
running = True
while running:
time.sleep(0.01)
1/0
t = threading.Thread(target=run)
t.start()
while not running:
time.sleep(0.01)
sys.stderr = None
running = False
t.join()
"""
rc
,
out
,
err
=
assert_python_ok
(
"-c"
,
script
)
self
.
assertEqual
(
out
,
''
)
self
.
assertIn
(
"Exception in thread"
,
err
)
self
.
assertIn
(
"Traceback (most recent call last):"
,
err
)
self
.
assertIn
(
"ZeroDivisionError"
,
err
)
self
.
assertNotIn
(
"Unhandled exception"
,
err
)
def
test_print_exception_stderr_is_none_2
(
self
):
script
=
r"""if 1:
import sys
import threading
import time
running = False
def run():
global running
running = True
while running:
time.sleep(0.01)
1/0
sys.stderr = None
t = threading.Thread(target=run)
t.start()
while not running:
time.sleep(0.01)
running = False
t.join()
"""
rc
,
out
,
err
=
assert_python_ok
(
"-c"
,
script
)
self
.
assertEqual
(
out
,
''
)
self
.
assertNotIn
(
"Unhandled exception"
,
err
)
class
LockTests
(
lock_tests
.
LockTests
):
locktype
=
staticmethod
(
threading
.
Lock
)
...
...
Lib/threading.py
Dosyayı görüntüle @
91943460
...
...
@@ -818,10 +818,10 @@ class Thread(_Verbose):
# shutdown) use self.__stderr. Otherwise still use sys (as in
# _sys) in case sys.stderr was redefined since the creation of
# self.
if
_sys
:
_sys
.
stderr
.
write
(
"Exception in thread
%
s:
\n
%
s
\n
"
%
if
_sys
and
_sys
.
stderr
is
not
None
:
print
>>
_sys
.
stderr
,
(
"Exception in thread
%
s:
\n
%
s
"
%
(
self
.
name
,
_format_exc
()))
el
s
e
:
el
if
self
.
__stderr
is
not
Non
e
:
# Do the best job possible w/o a huge amt. of code to
# approximate a traceback (code ideas from
# Lib/traceback.py)
...
...
Misc/NEWS
Dosyayı görüntüle @
91943460
...
...
@@ -21,6 +21,10 @@ Core and Builtins
Library
-------
-
Issue
#
22423
:
Unhandled
exception
in
thread
no
longer
causes
unhandled
AttributeError
when
sys
.
stderr
is
None
.
-
Issue
#
22419
:
Limit
the
length
of
incoming
HTTP
request
in
wsgiref
server
to
65536
bytes
and
send
a
414
error
code
for
higher
lengths
.
Patch
contributed
by
Devin
Cook
.
...
...
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