[New-bugs-announce] [issue11315] Cookie.py breaks when passed unicode, fix included

Alexander Tsepkov report at bugs.python.org
Fri Feb 25 05:05:03 CET 2011

New submission from Alexander Tsepkov <atsepkov at gmail.com>:

in Lib/Cookie.py, BaseCookie load() method performs the following comparison on line 624:

str(rawdata) == str("")

This breaks when a unicode string is passed in for rawdata. I've included a patch that fixes this issue by using isinstance(rawdata, basestring) comparison instead. Additionally the patch encodes rawdata in ascii before sending it to __ParseString() since that method does not support unicode.

components: Unicode
files: cookie_patch.patch
keywords: patch
messages: 129330
nosy: Alexander.Tsepkov
priority: normal
severity: normal
status: open
title: Cookie.py breaks when passed unicode, fix included
versions: Python 2.6
Added file: http://bugs.python.org/file20883/cookie_patch.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list