Bugs item #1358186, was opened at 2005-11-16 16:28
Message generated for change (Comment added) made by holle
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1358186&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Holger Lehmann (holle)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect handling of unicode "strings" in asynchat.py

Initial Comment:
While debugging my Zope installation using the   
DeadLockDebugger along with the threadframe module   
under Python 2.3 and 2.4 I stumbled upon a weird   
behaviour of the method refill_buffer ind the class   
async_chat in the file asynchat.py (Around line 198).  
  
There is a special handling for strings:  
[...]  
elif isinstance(p, str):  
  self.producer_fifo.pop()  
  self.ac_out_buffer = self.ac_out_buffer + p  
  return  
data = p.more()  
[...]  
Now, if p is an instance of string, it gets a special  
handling and the function returns.  
But if p is an instance of unicode, it does not get  
the special handling, but dies in the line  
data = p.more()  
with the error, that unicode does not have a function  
named more.  
  
I was able to program a workaround by testing for str  
or unicode. Please see the attached diff-file for  
details. The code now works as expected. 
 
I guess a better way would be to import types and 
change the if into a "type(p) in types.StringTypes", 
but I did not dare to do this. 
 
I have not checked the code to see if there are more 
conditionals broken the same way. 

----------------------------------------------------------------------

>Comment By: Holger Lehmann (holle)
Date: 2005-11-16 16:34

Message:
Logged In: YES 
user_id=332779

Just for the record: 
 
I am using Linux 2.6.11 and Python 2.4 (SuSE 9.3) 
as well as Linux 2.6.5 and Python 2.3.3 (SLES 9 Beta 4). 
 
Both Python installations contain a sitecustomize.py with 
the following content: 
import sys 
sys.setdefaultencoding('iso-8859-1') 
 
The environment contains a variable LC_CTYPE set to: 
de_DE.UTF-8 
 
The Zope is a 2.7.3 compiled on both of the above machines 
by myself. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1358186&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to