[python-debian/master 17/36] If StandardError does not exist (as in Python 3), inherit changelog exception classes from Exception instead.
Colin Watson
cjwatson at canonical.com
Mon Oct 8 07:41:22 UTC 2012
---
lib/debian/changelog.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/debian/changelog.py b/lib/debian/changelog.py
index a30ee0c..df0d3df 100644
--- a/lib/debian/changelog.py
+++ b/lib/debian/changelog.py
@@ -33,7 +33,14 @@ import warnings
from debian import debian_support
-class ChangelogParseError(StandardError):
+# Python 3 doesn't have StandardError, but let's avoid changing our
+# exception inheritance hierarchy for Python 2.
+try:
+ _base_exception_class = StandardError
+except NameError:
+ _base_exception_class = Exception
+
+class ChangelogParseError(_base_exception_class):
"""Indicates that the changelog could not be parsed"""
is_user_error = True
@@ -43,11 +50,11 @@ class ChangelogParseError(StandardError):
def __str__(self):
return "Could not parse changelog: "+self._line
-class ChangelogCreateError(StandardError):
+class ChangelogCreateError(_base_exception_class):
"""Indicates that changelog could not be created, as all the information
required was not given"""
-class VersionError(StandardError):
+class VersionError(_base_exception_class):
"""Indicates that the version does not conform to the required format"""
is_user_error = True
--
1.7.2.5
More information about the pkg-python-debian-commits
mailing list