Issue 760475: asyncore.py and "handle_error" (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/38708

classification

Title: asyncore.py and "handle_error"
Type: Stage:
Components: Library (Lib) Versions: Python 2.3

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: josiahcarlson Nosy List: jcea, jhylton, josiahcarlson
Priority: normal Keywords:

Created on 2003-06-25 13:11 by jcea, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (5)
msg16595 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2003-06-25 13:11
When an uncached exception arises in "asyncore", the method "handle_error" is called. This method calls "self.close()" when it MUST call "self.handle_close()", in order to support correctly the "delegation" design pattern, for example.
msg16596 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2003-06-25 18:11
Logged In: YES user_id=31392 Can you expand on your comments. I don't know what the delegation design pattern you refer to is. Can you provide an example of why it is necessary that asyncore not call close()?
msg16597 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2007-01-06 23:02
While the default .close() method is called inside .handle_close(), not calling .handle_close() in asyncore prevents any subclassed .handle_close() behavior to be run. Say, for example, that a user has written a subclass where within .handle_connect() the socket is registered somewhere (perhaps for I/O statistics in an FTP or Bittorrent application). Where it would make sense to place the unregistration code is within a .handle_close() method, which is bypassed by the standard .handle_error() code. I suggest switching to the self.handle_close() call at the end of handle_error() . Doing so preserves the passing of the test suite on release 2.5 on Windows.
msg69215 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2008-07-03 18:00
I forgot to fix this in my most recent commits, but I'll fix it this weekend for Python 2.6 .
msg69378 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2008-07-07 05:05
Fixed for 2.6 in changelist 64768. Fixed for 3.0 in changelist 64770.
History
Date User Action Args
2022-04-10 16:09:25 admin set github: 38708
2008-07-07 05:05:34 josiahcarlson set status: open -> closedresolution: fixedmessages: +
2008-07-03 18:00:12 josiahcarlson set messages: +
2003-06-25 13:11:28 jcea create