[ python-Bugs-1358186 ] Incorrect handling of unicode "strings" in asynchat.py
SourceForge.net
noreply at sourceforge.net
Wed Nov 16 16:28:20 CET 2005
Bugs item #1358186, was opened at 2005-11-16 16:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1358186&group_id=5470
More information about the Python-bugs-list
mailing list