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: Fix: asynchat.py: endless loop
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, ber
Priority: normal Keywords: patch

Created on 2002-12-06 21:57 by ber, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
asynchat-r1.19.py.patch ber, 2002-12-06 21:58 patch against asynchat.py r1.19
Messages (5)
msg41907 - (view) Author: Bernhard Reiter (ber) (Python committer) Date: 2002-12-06 21:57
Patch against asynchat.py revision 1.19 in Python SF CVS. 
 
Fixes endless loop when terminator='' is used. 
 
Diagnosis: 
If we do not catch the empty string no buffer will be consumed 
lin line 134 and the while loop does not terminate. 
 
Cure:  
Go back to old behaviour and call collect everything with '' and None. 
 
Background: 
Especially annoying because early versions (rev 1.1, coming with 
python1.5) 
did not have this bug and the comment in set_terminator()  
says that strings of all length are okay (among other things). 
The bug was introduced in rev 1.2. 
 
	Bernhard Reiter <bernhard@intevation.de> 
msg41908 - (view) Author: Bernhard Reiter (ber) (Python committer) Date: 2002-12-06 22:37
Logged In: YES 
user_id=113859

The patch also fixes the terminator=0 problem 
which is similiar. 
msg41909 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-02-03 19:34
Logged In: YES 
user_id=11375

Surely in your patched version, the code should be 
'if not terminator: ...'.  Otherwise the patch reverses the sense of the test.
msg41910 - (view) Author: Bernhard Reiter (ber) (Python committer) Date: 2003-02-03 19:39
Logged In: YES 
user_id=113859

Yes, of course.
I stopped experimenting with numeric and empty string
terminators
after hitting this bug, so I uploaded the flawed fix.
msg41911 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-03-10 15:28
Logged In: YES 
user_id=11375

A fix has been checked in as rev.1.21 of asynchat.py in the CVS tree.  Thanks for your help!
History
Date User Action Args
2022-04-10 16:05:58adminsetgithub: 37577
2002-12-06 21:57:32bercreate