]> granicus.if.org Git - python/commit
bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2898)
authorNir Soffer <nirsof@gmail.com>
Wed, 26 Jul 2017 23:27:08 +0000 (02:27 +0300)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 26 Jul 2017 23:27:08 +0000 (01:27 +0200)
commit25de5baf3eaebddbf879aacf49c0f614f922dc42
treec5622518171735ef088c48e22a821496ce1eba0e
parentbb7fd3f4d08091b2b68333267a4d5fdef03bda44
bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2898)

* 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