bpo-31647: Fix write_eof() after close() for SelectorSocketTransport (GH-7149) (GH-7153)

Fixed bug where calling write_eof() on a _SelectorSocketTransport after
it's already closed raises AttributeError.
(cherry picked from commit 23f587e395)

Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2018-05-28 09:04:09 -07:00 committed by Yury Selivanov
parent 51d0a2c8dd
commit 1f21ae710d
3 changed files with 9 additions and 1 deletions

View file

@ -899,7 +899,7 @@ class _SelectorSocketTransport(_SelectorTransport):
self._sock.shutdown(socket.SHUT_WR)
def write_eof(self):
if self._eof:
if self._closing or self._eof:
return
self._eof = True
if not self._buffer: