From fe917fcced41a48bf25f7667b8b6c9748065636b Mon Sep 17 00:00:00 2001 From: adustman Date: Sat, 8 Sep 2012 18:44:34 +0000 Subject: [PATCH] _mysql imports now, but still crashes --- MySQLdb/_mysql.c | 4 +++- MySQLdb/_mysql_exceptions.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index 8c1da47..5d59f34 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -3018,8 +3018,10 @@ init_mysql(void) (PyObject *)&_mysql_ResultObject_Type)) goto error; Py_INCREF(&_mysql_ResultObject_Type); - if (!(emod = PyImport_ImportModule("_mysql_exceptions"))) + if (!(emod = PyImport_ImportModule("_mysql_exceptions"))) { + PyErr_Print(); goto error; + } if (!(edict = PyModule_GetDict(emod))) goto error; if (!(_mysql_MySQLError = _mysql_NewException(dict, edict, "MySQLError"))) diff --git a/MySQLdb/_mysql_exceptions.py b/MySQLdb/_mysql_exceptions.py index 98037e5..3241e74 100644 --- a/MySQLdb/_mysql_exceptions.py +++ b/MySQLdb/_mysql_exceptions.py @@ -5,7 +5,12 @@ These classes are dictated by the DB API v2.0: http://www.python.org/topics/database/DatabaseAPI-2.0.html """ -from exceptions import Exception, StandardError, Warning +try: + from exceptions import Exception, StandardError, Warning +except ImportError: + # Python 3 + StandardError = Exception + class MySQLError(StandardError): @@ -80,4 +85,3 @@ class NotSupportedError(DatabaseError): has transactions turned off.""" -del Exception, StandardError