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
3a1c738e
Kaydet (Commit)
3a1c738e
authored
Ara 18, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23074: asyncio.get_event_loop() now raises an exception if the thread
has no event loop even if assertions are disabled.
üst
2338156f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
base_events.py
Lib/asyncio/base_events.py
+1
-1
events.py
Lib/asyncio/events.py
+3
-3
test_events.py
Lib/test/test_asyncio/test_events.py
+2
-2
No files found.
Lib/asyncio/base_events.py
Dosyayı görüntüle @
3a1c738e
...
...
@@ -420,7 +420,7 @@ class BaseEventLoop(events.AbstractEventLoop):
"""
try
:
current
=
events
.
get_event_loop
()
except
Assertion
Error
:
except
Runtime
Error
:
return
if
current
is
not
self
:
raise
RuntimeError
(
...
...
Lib/asyncio/events.py
Dosyayı görüntüle @
3a1c738e
...
...
@@ -517,9 +517,9 @@ class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy):
not
self
.
_local
.
_set_called
and
isinstance
(
threading
.
current_thread
(),
threading
.
_MainThread
)):
self
.
set_event_loop
(
self
.
new_event_loop
())
assert
self
.
_local
.
_loop
is
not
None
,
\
(
'There is no current event loop in thread
%
r.'
%
threading
.
current_thread
()
.
name
)
if
self
.
_local
.
_loop
is
None
:
raise
RuntimeError
(
'There is no current event loop in thread
%
r.'
%
threading
.
current_thread
()
.
name
)
return
self
.
_local
.
_loop
def
set_event_loop
(
self
,
loop
):
...
...
Lib/test/test_asyncio/test_events.py
Dosyayı görüntüle @
3a1c738e
...
...
@@ -2252,14 +2252,14 @@ class PolicyTests(unittest.TestCase):
def
test_get_event_loop_after_set_none
(
self
):
policy
=
asyncio
.
DefaultEventLoopPolicy
()
policy
.
set_event_loop
(
None
)
self
.
assertRaises
(
Assertion
Error
,
policy
.
get_event_loop
)
self
.
assertRaises
(
Runtime
Error
,
policy
.
get_event_loop
)
@mock.patch
(
'asyncio.events.threading.current_thread'
)
def
test_get_event_loop_thread
(
self
,
m_current_thread
):
def
f
():
policy
=
asyncio
.
DefaultEventLoopPolicy
()
self
.
assertRaises
(
Assertion
Error
,
policy
.
get_event_loop
)
self
.
assertRaises
(
Runtime
Error
,
policy
.
get_event_loop
)
th
=
threading
.
Thread
(
target
=
f
)
th
.
start
()
...
...
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