#193 Warnings give 'unhashable type' errror

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2006-07-07
Henk Punt
No

my setup (gentoo, python 2.4.2,

MySQLdb.version_info
(1, 2, 1, 'final', 2)

)
mysql --version
mysql Ver 14.7 Distrib 4.1.14, for pc-linux-gnu
(x86_64) using readline 5.0

throws exception when a warning is emitted from mysql
i printed the warning at line 80 of
/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py
as you can see below, the warning w[-1] is of type
array('c') which apparently is unhashable

cl161 sandbox # python rosterexport.py
('Warning', 1265L, array('c', "Data truncated for
column 'roster_nick' at row 1"))

Traceback (most recent call last):
File "rosterexport.py", line 56, in ?
src.execute(roster_select, (i, i + MEMBERS_PER_SELECT))
File
"/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py",
line 166, in execute
self._warning_check()
File
"/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py",
line 81, in _warning_check
warn(w[-1], self.Warning, 3)
File "/usr/lib/python2.4/warnings.py", line 61, in warn
warn_explicit(message, category, filename, lineno,
module, registry)
File "/usr/lib/python2.4/warnings.py", line 80, in
warn_explicit
if registry.get(key):
TypeError: unhashable type

Discussion

  • Henk Punt

    Henk Punt - 2006-07-07

    Logged In: YES
    user_id=729698

    looking at the other bugs, i think it has to do with the
    fact that we are running mysql in utf-8 mode

     
  • Andy Dustman

    Andy Dustman - 2006-07-07

    Logged In: YES
    user_id=71372

    Are you using a binary collation?

     
  • Andy Dustman

    Andy Dustman - 2006-08-26

    Logged In: YES
    user_id=71372

    Should be fixed in development version as it no longer
    returns arrays for binary collations.

     

Log in to post a comment.