Skip to content

Commit 31af4db

Browse files
code-health: remove StandardError
StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2] declares that database modules targeting Python 3 should use Exception as base class instead. 1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror 2. https://peps.python.org/pep-0249/#footnotes Part of #212
1 parent 39d1acf commit 31af4db

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Diff for: tarantool/error.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
The PEP-249 says that database related exceptions must be inherited as follows:
77
8-
StandardError
8+
Exception
99
|__Warning
1010
|__Error
1111
|__InterfaceError
@@ -29,21 +29,13 @@
2929
import warnings
3030

3131

32-
try:
33-
class Warning(StandardError):
34-
'''Exception raised for important warnings
35-
like data truncations while inserting, etc. '''
36-
except NameError:
37-
class Warning(Exception):
38-
'''Exception raised for important warnings
39-
like data truncations while inserting, etc. '''
4032

41-
try:
42-
class Error(StandardError):
43-
'''Base class for error exceptions'''
44-
except NameError:
45-
class Error(Exception):
46-
'''Base class for error exceptions'''
33+
class Warning(Exception):
34+
'''Exception raised for important warnings
35+
like data truncations while inserting, etc. '''
36+
37+
class Error(Exception):
38+
'''Base class for error exceptions'''
4739

4840

4941
class InterfaceError(Error):

0 commit comments

Comments
 (0)