mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merge 3.6 (issue #27243)
This commit is contained in:
commit
0ee446c894
2 changed files with 10 additions and 10 deletions
|
@ -1398,7 +1398,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
|
|
||||||
buffer = []
|
buffer = []
|
||||||
async def test1():
|
async def test1():
|
||||||
with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"):
|
with self.assertWarnsRegex(DeprecationWarning, "legacy"):
|
||||||
async for i1, i2 in AsyncIter():
|
async for i1, i2 in AsyncIter():
|
||||||
buffer.append(i1 + i2)
|
buffer.append(i1 + i2)
|
||||||
|
|
||||||
|
@ -1412,7 +1412,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
buffer = []
|
buffer = []
|
||||||
async def test2():
|
async def test2():
|
||||||
nonlocal buffer
|
nonlocal buffer
|
||||||
with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"):
|
with self.assertWarnsRegex(DeprecationWarning, "legacy"):
|
||||||
async for i in AsyncIter():
|
async for i in AsyncIter():
|
||||||
buffer.append(i[0])
|
buffer.append(i[0])
|
||||||
if i[0] == 20:
|
if i[0] == 20:
|
||||||
|
@ -1431,7 +1431,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
buffer = []
|
buffer = []
|
||||||
async def test3():
|
async def test3():
|
||||||
nonlocal buffer
|
nonlocal buffer
|
||||||
with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"):
|
with self.assertWarnsRegex(DeprecationWarning, "legacy"):
|
||||||
async for i in AsyncIter():
|
async for i in AsyncIter():
|
||||||
if i[0] > 20:
|
if i[0] > 20:
|
||||||
continue
|
continue
|
||||||
|
@ -1514,7 +1514,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
return 123
|
return 123
|
||||||
|
|
||||||
async def foo():
|
async def foo():
|
||||||
with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"):
|
with self.assertWarnsRegex(DeprecationWarning, "legacy"):
|
||||||
async for i in I():
|
async for i in I():
|
||||||
print('never going to happen')
|
print('never going to happen')
|
||||||
|
|
||||||
|
@ -1623,7 +1623,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
1/0
|
1/0
|
||||||
async def foo():
|
async def foo():
|
||||||
nonlocal CNT
|
nonlocal CNT
|
||||||
with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"):
|
with self.assertWarnsRegex(DeprecationWarning, "legacy"):
|
||||||
async for i in AI():
|
async for i in AI():
|
||||||
CNT += 1
|
CNT += 1
|
||||||
CNT += 10
|
CNT += 10
|
||||||
|
@ -1650,7 +1650,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
self.assertEqual(CNT, 0)
|
self.assertEqual(CNT, 0)
|
||||||
|
|
||||||
def test_for_9(self):
|
def test_for_9(self):
|
||||||
# Test that PendingDeprecationWarning can safely be converted into
|
# Test that DeprecationWarning can safely be converted into
|
||||||
# an exception (__aiter__ should not have a chance to raise
|
# an exception (__aiter__ should not have a chance to raise
|
||||||
# a ZeroDivisionError.)
|
# a ZeroDivisionError.)
|
||||||
class AI:
|
class AI:
|
||||||
|
@ -1660,13 +1660,13 @@ class CoroutineTest(unittest.TestCase):
|
||||||
async for i in AI():
|
async for i in AI():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with self.assertRaises(PendingDeprecationWarning):
|
with self.assertRaises(DeprecationWarning):
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
run_async(foo())
|
run_async(foo())
|
||||||
|
|
||||||
def test_for_10(self):
|
def test_for_10(self):
|
||||||
# Test that PendingDeprecationWarning can safely be converted into
|
# Test that DeprecationWarning can safely be converted into
|
||||||
# an exception.
|
# an exception.
|
||||||
class AI:
|
class AI:
|
||||||
async def __aiter__(self):
|
async def __aiter__(self):
|
||||||
|
@ -1675,7 +1675,7 @@ class CoroutineTest(unittest.TestCase):
|
||||||
async for i in AI():
|
async for i in AI():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with self.assertRaises(PendingDeprecationWarning):
|
with self.assertRaises(DeprecationWarning):
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
run_async(foo())
|
run_async(foo())
|
||||||
|
|
|
@ -1917,7 +1917,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
Py_DECREF(iter);
|
Py_DECREF(iter);
|
||||||
|
|
||||||
if (PyErr_WarnFormat(
|
if (PyErr_WarnFormat(
|
||||||
PyExc_PendingDeprecationWarning, 1,
|
PyExc_DeprecationWarning, 1,
|
||||||
"'%.100s' implements legacy __aiter__ protocol; "
|
"'%.100s' implements legacy __aiter__ protocol; "
|
||||||
"__aiter__ should return an asynchronous "
|
"__aiter__ should return an asynchronous "
|
||||||
"iterator, not awaitable",
|
"iterator, not awaitable",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue