diff --git a/MySQLdb/__init__.py b/MySQLdb/__init__.py index b567363b..2851b9bc 100644 --- a/MySQLdb/__init__.py +++ b/MySQLdb/__init__.py @@ -13,12 +13,11 @@ MySQLdb.converters module. """ -try: - from MySQLdb.release import version_info - from . import _mysql +# Check if the version of _mysql matches the version of MySQLdb. +from MySQLdb.release import version_info +from . import _mysql - assert version_info == _mysql.version_info -except Exception: +if version_info != _mysql.version_info: raise ImportError( "this is MySQLdb version {}, but _mysql is version {!r}\n_mysql: {!r}".format( version_info, _mysql.version_info, _mysql.__file__