diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-06 22:15:46 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-07 00:45:56 -0500 |
commit | aaf080611894aa70af421380af3bca23ad998a8d (patch) | |
tree | 8c5baaf6b9b117ee1a4a3c7f65163c8dff37373d /src/python-systemd/_reader.c | |
parent | 1d98d9a62c16c8282d02942d80e025ceec962c9b (diff) |
systemd-python: catch only ValueErrors in conversion code
First of all, 'try: ... except: ...' (with no exception specified) is
always a no-no, since it catches all BaseExceptions, which includes ^C
and other stuff which should almost never be caught.
Now the conversion is stricter, and only one conversion is attempted,
and only a ValueEror is caught. It seems reasonable to catch ValueErrors,
since the entries in the journal are not verified, and any erroneous
application might log a field which cannot be converted. The consumer
of events must only check if a field is an instance of bytes and can
otherwise assume that the conversion was performed correctly.
Order of arguments in Reader.__init__ has been changed to match order
in _Reader.__init__.
Conversions have been updated to work under Python 2 and 3.
Diffstat (limited to 'src/python-systemd/_reader.c')
0 files changed, 0 insertions, 0 deletions