Skip to content

Commit fe917fc

Browse files
author
adustman
committed
_mysql imports now, but still crashes
1 parent a5c7996 commit fe917fc

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎MySQLdb/_mysql.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3018,8 +3018,10 @@ init_mysql(void)
30183018
(PyObject *)&_mysql_ResultObject_Type))
30193019
goto error;
30203020
Py_INCREF(&_mysql_ResultObject_Type);
3021-
if (!(emod = PyImport_ImportModule("_mysql_exceptions")))
3021+
if (!(emod = PyImport_ImportModule("_mysql_exceptions"))) {
3022+
PyErr_Print();
30223023
goto error;
3024+
}
30233025
if (!(edict = PyModule_GetDict(emod))) goto error;
30243026
if (!(_mysql_MySQLError =
30253027
_mysql_NewException(dict, edict, "MySQLError")))

‎MySQLdb/_mysql_exceptions.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
http://www.python.org/topics/database/DatabaseAPI-2.0.html
66
"""
77

8-
from exceptions import Exception, StandardError, Warning
8+
try:
9+
from exceptions import Exception, StandardError, Warning
10+
except ImportError:
11+
# Python 3
12+
StandardError = Exception
13+
914

1015
class MySQLError(StandardError):
1116

@@ -80,4 +85,3 @@ class NotSupportedError(DatabaseError):
8085
has transactions turned off."""
8186

8287

83-
del Exception, StandardError

0 commit comments

Comments
 (0)