Skip to content

Commit 2316313

Browse files
authored
Add __module__ attributes to exception classes. (#523)
1 parent 5340191 commit 2316313

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: MySQLdb/_exceptions.py

+22
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,44 @@
99
class MySQLError(Exception):
1010
"""Exception related to operation with MySQL."""
1111

12+
__module__ = "MySQLdb"
13+
1214

1315
class Warning(Warning, MySQLError):
1416
"""Exception raised for important warnings like data truncations
1517
while inserting, etc."""
1618

19+
__module__ = "MySQLdb"
20+
1721

1822
class Error(MySQLError):
1923
"""Exception that is the base class of all other error exceptions
2024
(not Warning)."""
2125

26+
__module__ = "MySQLdb"
27+
2228

2329
class InterfaceError(Error):
2430
"""Exception raised for errors that are related to the database
2531
interface rather than the database itself."""
2632

33+
__module__ = "MySQLdb"
34+
2735

2836
class DatabaseError(Error):
2937
"""Exception raised for errors that are related to the
3038
database."""
3139

40+
__module__ = "MySQLdb"
41+
3242

3343
class DataError(DatabaseError):
3444
"""Exception raised for errors that are due to problems with the
3545
processed data like division by zero, numeric value out of range,
3646
etc."""
3747

48+
__module__ = "MySQLdb"
49+
3850

3951
class OperationalError(DatabaseError):
4052
"""Exception raised for errors that are related to the database's
@@ -43,27 +55,37 @@ class OperationalError(DatabaseError):
4355
found, a transaction could not be processed, a memory allocation
4456
error occurred during processing, etc."""
4557

58+
__module__ = "MySQLdb"
59+
4660

4761
class IntegrityError(DatabaseError):
4862
"""Exception raised when the relational integrity of the database
4963
is affected, e.g. a foreign key check fails, duplicate key,
5064
etc."""
5165

66+
__module__ = "MySQLdb"
67+
5268

5369
class InternalError(DatabaseError):
5470
"""Exception raised when the database encounters an internal
5571
error, e.g. the cursor is not valid anymore, the transaction is
5672
out of sync, etc."""
5773

74+
__module__ = "MySQLdb"
75+
5876

5977
class ProgrammingError(DatabaseError):
6078
"""Exception raised for programming errors, e.g. table not found
6179
or already exists, syntax error in the SQL statement, wrong number
6280
of parameters specified, etc."""
6381

82+
__module__ = "MySQLdb"
83+
6484

6585
class NotSupportedError(DatabaseError):
6686
"""Exception raised in case a method or database API was used
6787
which is not supported by the database, e.g. requesting a
6888
.rollback() on a connection that does not support transaction or
6989
has transactions turned off."""
90+
91+
__module__ = "MySQLdb"

0 commit comments

Comments
 (0)