classification
Title: asynchat's handle_error inconsistency
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: BreamoreBoy, giampaolo.rodola, intgr, josiah.carlson, josiahcarlson, nirs, vstinner
Priority: normal Keywords: patch

Created on 2008-11-07 12:14 by giampaolo.rodola, last changed 2014-08-29 21:55 by BreamoreBoy.

Files
File name Uploaded Description Edit
asynchat.patch giampaolo.rodola, 2008-11-07 12:14 review
Messages (4)
msg75601 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-11-07 12:14
Suppose you have tow sockets handled by two asynchat.async_chat class
instances and from class1 you want to send some data through class2:

class1(asynchat.async_chat):
    
   ...
   
   def mymethod(self):
       class2_instance.push_with_producer(producer)


Since push_with_producer automatically calls initiate_send() if an error
occurs while class2 reads the first chunk of data from the producer,
class1's handle_error gets called.
If the error occurs when reading the next chunks of data class2's
handle_error will be called instead.
This is an inconsistency that should be fixed so that always class2's
handle_error gets called.

The patch in attachment does that.
msg140534 - (view) Author: Nir Soffer (nirs) * Date: 2011-07-17 19:07
The idea is good, but seems that error handling should be inlined into initiate_send.

Also those 3 special exceptions should be defined once in the module instead of repeating them.
msg225996 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-08-27 15:51
This issue is 6 years old. I don't understand the bug and the patch has no unit test. I suggest to close the issue as out of date. The asynchat module is now deprecated in favor of the new shiny asyncio module.
msg226090 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-08-29 21:55
#6550 and #11267 have been closed as out of date as asynchat and asyncore are effectively deprecated in favour of asyncio so can't this go the same way?
History
Date User Action Args
2014-08-29 21:55:50BreamoreBoysetnosy: + BreamoreBoy
messages: + msg226090
2014-08-29 20:38:24terry.reedysetversions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2
2014-08-27 15:51:15vstinnersetnosy: + vstinner
messages: + msg225996
2011-07-17 19:07:12nirssetnosy: + nirs
messages: + msg140534
2010-07-10 11:22:36giampaolo.rodolasetassignee: giampaolo.rodola
2010-07-10 09:37:33BreamoreBoysetstage: test needed
versions: + Python 3.1, Python 3.2, - Python 3.0
2009-03-28 12:14:54intgrsetnosy: + intgr
2008-11-07 12:17:53giampaolo.rodolasetversions: + Python 3.0
2008-11-07 12:14:52giampaolo.rodolacreate