Re: [PATCH] python: remove IOError in certain cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Petr Lautrbach <plautrba@xxxxxxxxxx> writes:

> Elijah Conners <business@xxxxxxxxxxxxxx> writes:
>
>> In certain cases, IOError caused the much more general exception OSError
>> to be unreachable.
>>
>> Signed-off-by: Elijah Conners <business@xxxxxxxxxxxxxx>
>
> Acked-by: Petr Lautrbach <plautrba@xxxxxxxxxx>
>

Merged, thanks!


>> ---
>>  python/semanage/semanage | 7 ++-----
>>  sandbox/sandbox          | 2 --
>>  2 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/python/semanage/semanage b/python/semanage/semanage
>> index 1d828128..c7a35fe4 100644
>> --- a/python/semanage/semanage
>> +++ b/python/semanage/semanage
>> @@ -970,8 +970,8 @@ def do_parser():
>>          devnull = os.open(os.devnull, os.O_WRONLY)
>>          os.dup2(devnull, sys.stdout.fileno())
>>          sys.exit(1)
>> -    except IOError as e:
>> -        sys.stderr.write("%s: %s\n" % (e.__class__.__name__, str(e)))
>> +    except OSError as e:
>> +        sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[1]))
>>          sys.exit(1)
>>      except KeyboardInterrupt:
>>          sys.exit(0)
>> @@ -981,9 +981,6 @@ def do_parser():
>>      except KeyError as e:
>>          sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[0]))
>>          sys.exit(1)
>> -    except OSError as e:
>> -        sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[1]))
>> -        sys.exit(1)
>>      except RuntimeError as e:
>>          sys.stderr.write("%s: %s\n" % (e.__class__.__name__, e.args[0]))
>>          sys.exit(1)
>> diff --git a/sandbox/sandbox b/sandbox/sandbox
>> index cd5709fb..1c9379ef 100644
>> --- a/sandbox/sandbox
>> +++ b/sandbox/sandbox
>> @@ -533,8 +533,6 @@ if __name__ == '__main__':
>>          error_exit(error.args[0])
>>      except KeyError as error:
>>          error_exit(_("Invalid value %s") % error.args[0])
>> -    except IOError as error:
>> -        error_exit(error)
>>      except KeyboardInterrupt:
>>          rc = 0
>>  
>> -- 
>> 2.29.2.windows.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux