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
98020812
Kaydet (Commit)
98020812
authored
Eyl 05, 2016
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.5 (closes #27811)
üst
4847f319
2f40ed4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
12 deletions
+24
-12
test_coroutines.py
Lib/test/test_coroutines.py
+8
-0
NEWS
Misc/NEWS
+3
-0
genobject.c
Objects/genobject.c
+13
-12
No files found.
Lib/test/test_coroutines.py
Dosyayı görüntüle @
98020812
...
...
@@ -1565,6 +1565,14 @@ class CoroutineTest(unittest.TestCase):
finally
:
aw
.
close
()
def
test_fatal_coro_warning
(
self
):
# Issue 27811
async
def
func
():
pass
with
warnings
.
catch_warnings
():
warnings
.
filterwarnings
(
"error"
)
func
()
support
.
gc_collect
()
class
CoroAsyncIOCompatTest
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
98020812
...
...
@@ -29,6 +29,9 @@ Core and Builtins
- Issue #27506: Support passing the bytes/bytearray.translate() "delete"
argument by keyword.
- Issue #27811: Fix a crash when a coroutine that has not been awaited is
finalized with warnings-as-errors enabled.
- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check
after use of '
def
' in _PyState_AddModule().
Initial patch by Christian Heimes.
...
...
Objects/genobject.c
Dosyayı görüntüle @
98020812
...
...
@@ -24,26 +24,27 @@ _PyGen_Finalize(PyObject *self)
PyObject
*
res
;
PyObject
*
error_type
,
*
error_value
,
*
error_traceback
;
if
(
gen
->
gi_frame
==
NULL
||
gen
->
gi_frame
->
f_stacktop
==
NULL
)
/* Generator isn't paused, so no need to close */
return
;
/* Save the current exception, if any. */
PyErr_Fetch
(
&
error_type
,
&
error_value
,
&
error_traceback
);
/* If `gen` is a coroutine, and if it was never awaited on,
issue a RuntimeWarning. */
if
(
gen
->
gi_code
!=
NULL
&&
((
PyCodeObject
*
)
gen
->
gi_code
)
->
co_flags
&
CO_COROUTINE
&&
gen
->
gi_frame
!=
NULL
&&
gen
->
gi_frame
->
f_lasti
==
-
1
&&
!
PyErr_Occurred
()
&&
PyErr_WarnFormat
(
PyExc_RuntimeWarning
,
1
,
"coroutine '%.50S' was never awaited"
,
gen
->
gi_qualname
))
return
;
if
(
gen
->
gi_frame
==
NULL
||
gen
->
gi_frame
->
f_stacktop
==
NULL
)
/* Generator isn't paused, so no need to close */
return
;
/* Save the current exception, if any. */
PyErr_Fetch
(
&
error_type
,
&
error_value
,
&
error_traceback
);
res
=
gen_close
(
gen
,
NULL
);
gen
->
gi_qualname
))
{
res
=
NULL
;
/* oops, exception */
}
else
{
res
=
gen_close
(
gen
,
NULL
);
}
if
(
res
==
NULL
)
PyErr_WriteUnraisable
(
self
);
...
...
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