database name *must* be of type str()

Bug #790226 reported by tormen on 2011-05-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Status tracked in Trunk
Fix Committed
Geert JM Vanderkelen
In Progress
Geert JM Vanderkelen

Bug Description

MySQL connector/python v0.3.2:

if you pass in a database name "1234" then mysql connector/python [ line 381] tries to do a .strip() on it which will fail as it is not a string.

It is probably arguable if this is a bug ...
but to me as python is officially dynamically typed [oh-yeah! ;) ...]
IMHO this line should be either:

   self._database = str(database).strip() if database else None
OR to save the str() call if not necessary:
   try: self._database = database.strip() if database else None
   except: self._database = str(database).strip() if database else None

Related branches

Thanks for this bug report!

  Fix: Unhandled exception when database was given as integer

  o There was an unhandled exception when you pass the database name as an
    integer. We now force the database name to be a string.
  o Using self._username and self._database when opening the connection
    in MySQLConnection.connect()
  o Adding test case for bug lp:790226

Changed in myconnpy:
assignee: nobody → Geert JM Vanderkelen (geertjmvdk)
importance: Undecided → Low
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers