[Python-modules-team] python-mysqldb bug in a select with a Set filed type

Jonas Meurer jonas at freesources.org
Sun Sep 2 03:46:38 UTC 2007


On 27/08/2007 Manuel J. Posse (CUCO) wrote:
> I am using Debian Etch on my System.
> 
> I was trying to use Mysql filed Set type over Python, and I have found a little bug in your code.
> 
> The bug is in the function Str2Set in the file "site-packages/MySQLdb/converters.py" line 44:
> 
> def Str2Set(s):
>     values = s.split(',')
>     return apply(str, tuple(values))
> 
> Must be something like:
> 
> def Str2Set(s):
>     values = s.split(',')
>     return map(str, tuple(values))        # if you want a list
>     return tuple(map(str, tuple(values))) # if you want a tuple

Hey Manuel,

This bug is fixed in newer versions of python-mysqldb. Unfortunately,
they did not make it into etch. This is how Str2Set() looks in 1.2.2-4
(from debian/unstable):

def Str2Set(s):
    values = s.split(',')
    return map(str, tuple(values))

...
 jonas



More information about the Python-modules-team mailing list