mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Sync asyncio code from default branch.
This commit is contained in:
parent
3a81f9ba46
commit
d08c363c26
2 changed files with 67 additions and 55 deletions
|
|
@ -6,6 +6,7 @@
|
|||
]
|
||||
|
||||
import socket
|
||||
import sys
|
||||
|
||||
if hasattr(socket, 'AF_UNIX'):
|
||||
__all__.extend(['open_unix_connection', 'start_unix_server'])
|
||||
|
|
@ -19,6 +20,7 @@
|
|||
|
||||
|
||||
_DEFAULT_LIMIT = 2**16
|
||||
_PY35 = sys.version_info >= (3, 5)
|
||||
|
||||
|
||||
class IncompleteReadError(EOFError):
|
||||
|
|
@ -485,3 +487,15 @@ def readexactly(self, n):
|
|||
n -= len(block)
|
||||
|
||||
return b''.join(blocks)
|
||||
|
||||
if _PY35:
|
||||
@coroutine
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
@coroutine
|
||||
def __anext__(self):
|
||||
val = yield from self.readline()
|
||||
if val == b'':
|
||||
raise StopAsyncIteration
|
||||
return val
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue