mirror of https://github.com/python/cpython
Merge 3.4 (asyncio)
This commit is contained in:
commit
0caf060056
|
@ -258,22 +258,8 @@ class StreamWriter:
|
|||
self._reader = reader
|
||||
self._loop = loop
|
||||
|
||||
def close(self):
|
||||
if self._transport is None:
|
||||
return
|
||||
self._transport.close()
|
||||
self._transport = None
|
||||
|
||||
def _check_closed(self):
|
||||
if self._transport is None:
|
||||
raise RuntimeError('StreamWriter is closed')
|
||||
|
||||
def __repr__(self):
|
||||
info = [self.__class__.__name__]
|
||||
if self._transport is not None:
|
||||
info.append('transport=%r' % self._transport)
|
||||
else:
|
||||
info.append('closed')
|
||||
info = [self.__class__.__name__, 'transport=%r' % self._transport]
|
||||
if self._reader is not None:
|
||||
info.append('reader=%r' % self._reader)
|
||||
return '<%s>' % ' '.join(info)
|
||||
|
@ -283,23 +269,21 @@ class StreamWriter:
|
|||
return self._transport
|
||||
|
||||
def write(self, data):
|
||||
self._check_closed()
|
||||
self._transport.write(data)
|
||||
|
||||
def writelines(self, data):
|
||||
self._check_closed()
|
||||
self._transport.writelines(data)
|
||||
|
||||
def write_eof(self):
|
||||
self._check_closed()
|
||||
return self._transport.write_eof()
|
||||
|
||||
def can_write_eof(self):
|
||||
self._check_closed()
|
||||
return self._transport.can_write_eof()
|
||||
|
||||
def close(self):
|
||||
return self._transport.close()
|
||||
|
||||
def get_extra_info(self, name, default=None):
|
||||
self._check_closed()
|
||||
return self._transport.get_extra_info(name, default)
|
||||
|
||||
@coroutine
|
||||
|
@ -311,7 +295,6 @@ class StreamWriter:
|
|||
w.write(data)
|
||||
yield from w.drain()
|
||||
"""
|
||||
self._check_closed()
|
||||
if self._reader is not None:
|
||||
exc = self._reader.exception()
|
||||
if exc is not None:
|
||||
|
|
Loading…
Reference in New Issue