Re: [PATCH 1/1] python/semanage: fix Python syntax of catching several exceptions

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

 



On Sat, Aug 4, 2018 at 11:34 AM, Jason Zaman <jason@xxxxxxxxxxxxx> wrote:
> On Sat, Aug 04, 2018 at 11:11:47AM +0200, Nicolas Iooss wrote:
>> "except OSError, ImportError:" does not perform what it says: it is the
>> Python 2 syntax of catching OSError exceptions as "ImportError" (like
>> "except OSError, e:"), and this is indeed caught by Python3:
>>
>>       File "./python/semanage/seobject.py", line 143
>>         except OSError, ImportError:
>>                       ^
>>     SyntaxError: invalid syntax
>>
>> The correct syntax consists in using parentheses.
>>
>> Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx>
>
> Acked-by: Jason Zaman <jason@xxxxxxxxxxxxx>

Thanks. I will wait one business day before merging this (in order to
let other developers the possibility to comment, even though this
change is trivial).

>> ---
>> For the record, I found this while playing with flake8 Python's linter.
>> I am currently working on upstreaming a script which would run this on
>> our Travis-CI environment in order to catch Python syntax errors before
>> they are introduced.
>
> Awesome! more linters are always good. I really do need to find the time
> to kill seobject more thoroughly tho, its so slow compared to direct
> setools. :(

The more I look into flake8, the more I want to make it integrated to
our review process... I will send a few patches later today in order
to fix issues that it found in the Python code (for example "procotol"
instead of "protocol" in sepolicy/gui.py).

Cheers,
Nicolas

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



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

  Powered by Linux