]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2900)
authorNir Soffer <nirsof@gmail.com>
Wed, 26 Jul 2017 23:24:52 +0000 (02:24 +0300)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 26 Jul 2017 23:24:52 +0000 (01:24 +0200)
commit29094cec7cddd561cac16ce93443ca72d740de4d
treeaa53f543cd40a2c2e8adef84b992d41d5d75c40c
parent0cba38d207dc233707b09787e6618cfca44cc2b7
bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2900)

* bpo-30980: Fix close test to fail

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

* bpo-30980: Fix double close protection

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

* bpo-30980: Fix fd leak introduced in the fixed test
Lib/asyncore.py
Lib/test/test_asyncore.py