Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
DifferentialOrange committed Oct 6, 2022
commit 9b8b4b25189c66c2c0a39df3cf651b6a275e12ea
22 changes: 7 additions & 15 deletions tarantool/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

The PEP-249 says that database related exceptions must be inherited as follows:

StandardError
Exception
|__Warning
|__Error
|__InterfaceError
Expand All @@ -29,21 +29,13 @@
import warnings


try:
class Warning(StandardError):
'''Exception raised for important warnings
like data truncations while inserting, etc. '''
except NameError:
class Warning(Exception):
'''Exception raised for important warnings
like data truncations while inserting, etc. '''

try:
class Error(StandardError):
'''Base class for error exceptions'''
except NameError:
class Error(Exception):
'''Base class for error exceptions'''
class Warning(Exception):
'''Exception raised for important warnings
like data truncations while inserting, etc. '''

class Error(Exception):
'''Base class for error exceptions'''


class InterfaceError(Error):
Expand Down