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.
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.
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.
#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?