New submission from Nir Soffer:
Commit 4d4c69dc35154a9c21fed1b6b4088e741fbc6ae6 added protection for double
close in file_wrapper.close, but the test did not consider that fact that
file_wrapper is dupping the file descriptor, making the test ineffective.
>>> fd1, fd2 = os.pipe()
>>> f = asyncore.file_wrapper(fd1)
>>> os.close(f.fd)
>>> f.close()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.5/asyncore.py", line 621, in close
os.close(self.fd)
OSError: [Errno 9] Bad file descriptor
>>> f.fd
4
>>> fd3, fd4 = os.pipe()
>>> fd3
4
>>> f.close()
>>> os.close(fd3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
f.close() closed an unrelated file descriptor.
----------
messages: 298753
nosy: Nir Soffer, haypo
priority: normal
severity: normal
status: open
title: Calling asyncore.file_wrapper.close twice may close unrelated file
descriptor
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30980>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com