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
7e3a91a5
Kaydet (Commit)
7e3a91a5
authored
Şub 10, 2016
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26136: Upgrade the generator_stop warning to DeprecationWarning
Patch by Anish Shah.
üst
b0cb42df
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
7 deletions
+19
-7
3.6.rst
Doc/whatsnew/3.6.rst
+8
-0
test_contextlib.py
Lib/test/test_contextlib.py
+1
-1
test_generators.py
Lib/test/test_generators.py
+3
-3
test_with.py
Lib/test/test_with.py
+2
-2
NEWS
Misc/NEWS
+4
-0
genobject.c
Objects/genobject.c
+1
-1
No files found.
Doc/whatsnew/3.6.rst
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -234,6 +234,14 @@ Deprecated features
(Contributed by Rose Ames in :issue:`25791`.)
Deprecated Python behavior
--------------------------
* Raising the :exc:`StopIteration` exception inside a generator will now generate a
:exc:`DeprecationWarning`, and will trigger a :exc:`RuntimeError` in Python 3.7.
See :ref:`whatsnew-pep-479` for details.
Removed
=======
...
...
Lib/test/test_contextlib.py
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -89,7 +89,7 @@ class ContextManagerTestCase(unittest.TestCase):
def
woohoo
():
yield
try
:
with
self
.
assertWarnsRegex
(
Pending
DeprecationWarning
,
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"StopIteration"
):
with
woohoo
():
raise
stop_exc
...
...
Lib/test/test_generators.py
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -245,11 +245,11 @@ class ExceptionTest(unittest.TestCase):
yield
with
self
.
assertRaises
(
StopIteration
),
\
self
.
assertWarnsRegex
(
Pending
DeprecationWarning
,
"StopIteration"
):
self
.
assertWarnsRegex
(
DeprecationWarning
,
"StopIteration"
):
next
(
gen
())
with
self
.
assertRaisesRegex
(
Pending
DeprecationWarning
,
with
self
.
assertRaisesRegex
(
DeprecationWarning
,
"generator .* raised StopIteration"
),
\
warnings
.
catch_warnings
():
...
...
@@ -268,7 +268,7 @@ class ExceptionTest(unittest.TestCase):
g
=
f
()
self
.
assertEqual
(
next
(
g
),
1
)
with
self
.
assertWarnsRegex
(
Pending
DeprecationWarning
,
"StopIteration"
):
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"StopIteration"
):
with
self
.
assertRaises
(
StopIteration
):
next
(
g
)
...
...
Lib/test/test_with.py
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -454,7 +454,7 @@ class ExceptionalTestCase(ContextmanagerAssertionMixin, unittest.TestCase):
with
cm
():
raise
StopIteration
(
"from with"
)
with
self
.
assertWarnsRegex
(
Pending
DeprecationWarning
,
"StopIteration"
):
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"StopIteration"
):
self
.
assertRaises
(
StopIteration
,
shouldThrow
)
def
testRaisedStopIteration2
(
self
):
...
...
@@ -482,7 +482,7 @@ class ExceptionalTestCase(ContextmanagerAssertionMixin, unittest.TestCase):
with
cm
():
raise
next
(
iter
([]))
with
self
.
assertWarnsRegex
(
Pending
DeprecationWarning
,
"StopIteration"
):
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"StopIteration"
):
self
.
assertRaises
(
StopIteration
,
shouldThrow
)
def
testRaisedGeneratorExit1
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -10,6 +10,10 @@ Release date: tba
Core and Builtins
-----------------
- Issue #26136: Upgrade the warning when a generator raises StopIteration
from PendingDeprecationWarning to DeprecationWarning. Patch by Anish
Shah.
- Issue #26204: The compiler now ignores all constant statements: bytes, str,
int, float, complex, name constants (None, False, True), Ellipsis
and ast.Constant; not only str and int. For example, ``1.0`` is now ignored
...
...
Objects/genobject.c
Dosyayı görüntüle @
7e3a91a5
...
...
@@ -178,7 +178,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
/* Pop the exception before issuing a warning. */
PyErr_Fetch
(
&
exc
,
&
val
,
&
tb
);
if
(
PyErr_WarnFormat
(
PyExc_
Pending
DeprecationWarning
,
1
,
if
(
PyErr_WarnFormat
(
PyExc_DeprecationWarning
,
1
,
"generator '%.50S' raised StopIteration"
,
gen
->
gi_qualname
))
{
/* Warning was converted to an error. */
...
...
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