debian/lib/python/debian_linux/config.py: Fix undefined exception type

SchemaItemBoolean and SchemaItemInteger attempt to raise an exception
of type Error when given invalid input, but this type has never been
defined.  Use ValueError instead.
This commit is contained in:
Ben Hutchings 2018-10-01 22:02:33 +01:00
parent 8b0aacdc26
commit ee1d2b9dff
2 changed files with 3 additions and 5 deletions

1
debian/changelog vendored
View File

@ -11,6 +11,7 @@ linux (4.19~rc6-1~exp1) UNRELEASED; urgency=medium
* debian/bin, debian/lib/python: Clean up imports based on pyflakes report * debian/bin, debian/lib/python: Clean up imports based on pyflakes report
* debian/bin, debian/lib/python: Delete write-only vars reported by pyflakes * debian/bin, debian/lib/python: Delete write-only vars reported by pyflakes
* debian/lib/python/debian_linux/gencontrol.py: Delete broken methods * debian/lib/python/debian_linux/gencontrol.py: Delete broken methods
* debian/lib/python/debian_linux/config.py: Fix undefined exception type
-- Ben Hutchings <ben@decadent.org.uk> Thu, 20 Sep 2018 02:40:54 +0100 -- Ben Hutchings <ben@decadent.org.uk> Thu, 20 Sep 2018 02:40:54 +0100

View File

@ -21,15 +21,12 @@ class SchemaItemBoolean(object):
return True return True
if i in ("false", "0"): if i in ("false", "0"):
return False return False
raise Error raise ValueError
class SchemaItemInteger(object): class SchemaItemInteger(object):
def __call__(self, i): def __call__(self, i):
try: return int(i.strip(), 0)
return int(i.strip(), 0)
except ValueError:
raise Error
class SchemaItemList(object): class SchemaItemList(object):