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
a4b884f9
Kaydet (Commit)
a4b884f9
authored
Eki 20, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28492: Fix how StopIteration is raised in _asyncio.Future
üst
82919ec4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
test_futures.py
Lib/test/test_asyncio/test_futures.py
+13
-0
NEWS
Misc/NEWS
+2
-0
_asynciomodule.c
Modules/_asynciomodule.c
+19
-2
No files found.
Lib/test/test_asyncio/test_futures.py
Dosyayı görüntüle @
a4b884f9
...
@@ -464,6 +464,19 @@ class FutureTests(test_utils.TestCase):
...
@@ -464,6 +464,19 @@ class FutureTests(test_utils.TestCase):
futures
.
_set_result_unless_cancelled
(
fut
,
2
)
futures
.
_set_result_unless_cancelled
(
fut
,
2
)
self
.
assertTrue
(
fut
.
cancelled
())
self
.
assertTrue
(
fut
.
cancelled
())
def
test_future_stop_iteration_args
(
self
):
fut
=
asyncio
.
Future
(
loop
=
self
.
loop
)
fut
.
set_result
((
1
,
2
))
fi
=
fut
.
__iter__
()
result
=
None
try
:
fi
.
send
(
None
)
except
StopIteration
as
ex
:
result
=
ex
.
args
[
0
]
else
:
self
.
fail
(
'StopIteration was expected'
)
self
.
assertEqual
(
result
,
(
1
,
2
))
class
FutureDoneCallbackTests
(
test_utils
.
TestCase
):
class
FutureDoneCallbackTests
(
test_utils
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
a4b884f9
...
@@ -28,6 +28,8 @@ Library
...
@@ -28,6 +28,8 @@ Library
- Issue #20766: Fix references leaked by pdb in the handling of SIGINT
- Issue #20766: Fix references leaked by pdb in the handling of SIGINT
handlers.
handlers.
- Issue #28492: Fix how StopIteration exception is raised in _asyncio.Future.
Build
Build
-----
-----
...
...
Modules/_asynciomodule.c
Dosyayı görüntüle @
a4b884f9
...
@@ -787,9 +787,26 @@ FutureIter_iternext(futureiterobject *it)
...
@@ -787,9 +787,26 @@ FutureIter_iternext(futureiterobject *it)
res
=
FutureObj_result
(
fut
,
NULL
);
res
=
FutureObj_result
(
fut
,
NULL
);
if
(
res
!=
NULL
)
{
if
(
res
!=
NULL
)
{
// normal result
/* The result of the Future is not an exception.
PyErr_SetObject
(
PyExc_StopIteration
,
res
);
We cunstruct an exception instance manually with
PyObject_CallFunctionObjArgs and pass it to PyErr_SetObject
(similarly to what genobject.c does).
This is to handle a situation when "res" is a tuple, in which
case PyErr_SetObject would set the value of StopIteration to
the first element of the tuple.
(See PyErr_SetObject/_PyErr_CreateException code for details.)
*/
PyObject
*
e
=
PyObject_CallFunctionObjArgs
(
PyExc_StopIteration
,
res
,
NULL
);
Py_DECREF
(
res
);
Py_DECREF
(
res
);
if
(
e
==
NULL
)
{
return
NULL
;
}
PyErr_SetObject
(
PyExc_StopIteration
,
e
);
Py_DECREF
(
e
);
}
}
it
->
future
=
NULL
;
it
->
future
=
NULL
;
...
...
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