This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: handle_close called twice in poll2
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder: Close asyncore/asynchat/smtpd issues and list them here
View: 45552
Assigned To: Nosy List: giampaolo.rodola, neologix, stutzbach, xdegaye
Priority: normal Keywords: patch

Created on 2011-11-08 17:32 by xdegaye, last changed 2022-04-11 14:57 by admin. This issue is now closed.

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
2022-04-11 14:57:23adminsetgithub: 57581
2021-10-21 11:31:21iritkatrielsetstatus: open -> closed
superseder: Close asyncore/asynchat/smtpd issues and list them here
resolution: wont fix
stage: resolved
2019-05-02 04:15:46josiahcarlsonsetnosy: - josiahcarlson
2019-03-15 23:36:56BreamoreBoysetnosy: - BreamoreBoy
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