]> granicus.if.org Git - python/commit
bpo-30980: Fix double close in asyncore.file_wrapper (#2789)
authorNir Soffer <nirsof@gmail.com>
Mon, 24 Jul 2017 21:18:06 +0000 (00:18 +0300)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 24 Jul 2017 21:18:06 +0000 (23:18 +0200)
commitc648a93ae342ac28d2abbb100161eae4f907d001
treefe57c9a1fbed51dbfd1d32b3bc73fcb0edfc5756
parent5b4feb7e86ecb813b2c56560f86cda2fd46b9579
bpo-30980: Fix double close in asyncore.file_wrapper (#2789)

* 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