mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Improved support for Python 3.
This commit is contained in:
@ -33,7 +33,11 @@ def defaulterrorhandler(connection, cursor, errorclass, errorvalue):
|
||||
connection.messages.append(error)
|
||||
del cursor
|
||||
del connection
|
||||
raise errorclass, errorvalue
|
||||
if errorclass is not None:
|
||||
raise errorclass(errorvalue)
|
||||
else:
|
||||
raise Exception(errorvalue)
|
||||
|
||||
|
||||
re_numeric_part = re.compile(r"^(\d+)")
|
||||
|
||||
|
@ -188,7 +188,7 @@ class BaseCursor(object):
|
||||
try:
|
||||
r = None
|
||||
r = self._query(query)
|
||||
except TypeError, m:
|
||||
except TypeError as m:
|
||||
if m.args[0] in ("not enough arguments for format string",
|
||||
"not all arguments converted"):
|
||||
self.messages.append((ProgrammingError, m.args[0]))
|
||||
@ -247,7 +247,7 @@ class BaseCursor(object):
|
||||
for key, item in a.iteritems()))
|
||||
else:
|
||||
q.append(qv % tuple([db.literal(item) for item in a]))
|
||||
except TypeError, msg:
|
||||
except TypeError as msg:
|
||||
if msg.args[0] in ("not enough arguments for format string",
|
||||
"not all arguments converted"):
|
||||
self.errorhandler(self, ProgrammingError, msg.args[0])
|
||||
|
Reference in New Issue
Block a user