classification
Title: handle_close called twice in poll2
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.5, Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, giampaolo.rodola, josiahcarlson, neologix, stutzbach, xdegaye
Priority: normal Keywords: patch

Created on 2011-11-08 17:32 by xdegaye, last changed 2014-06-21 00:27 by BreamoreBoy.

Files
File name Uploaded Description Edit
handle_close.diff xdegaye, 2011-11-08 17:32 review
Messages (2)
msg147311 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2011-11-08 17:32
When use_poll is True, test_handle_close in test_asyncore.py invokes
twice the handle_close() method.

The attached patch:

    modifies test_handle_close so that it fails when handle_close() is
    called more than once

    includes a fix that makes readwrite() behave like poll(): check
    that the dispatcher instance is still in the socket map, before
    calling the handle_xxx methods
msg221136 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-21 00:27
To me the patched code in readwrite seems cut and paste.  Could it be written something like this?

have_fileno = not map or obj._fileno in map
if have_fileno and flags & select.POLLIN:
    obj.handle_read_event()
if have_fileno and flags & select.POLLOUT:
    obj.handle_write_event()
if have_fileno and flags & select.POLLPRI:
    obj.handle_expt_event()
if (have_fileno and flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
     obj.handle_close()
History
Date User Action Args
2014-06-21 00:27:38BreamoreBoysetnosy: + BreamoreBoy

messages: + msg221136
versions: + Python 3.4, Python 3.5, - Python 3.3
2011-11-08 17:32:12xdegayecreate