From: Michal Srb <msrb@redhat.com>
To: Jason Zaman <jason@perfinion.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: [PATCH] policycoreutils/semanage: improve compatibility with Python 3 in seobject.py
Date: Thu, 30 Jul 2015 11:16:10 +0200 [thread overview]
Message-ID: <55B9EB5A.5090804@redhat.com> (raw)
In-Reply-To: <20150730080404.GA1792@meriadoc.perfinion.com>
On 07/30/2015 10:04 AM, Jason Zaman wrote:
> On Thu, Jul 30, 2015 at 09:25:15AM +0200, Michal Srb wrote:
>> - replace print statement with print function
>> - use reserved word `as` in try-except
>> - work with dict.keys() in a way compatible with both Python 2 and 3
>>
>> Signed-off-by: Michal Srb <msrb@redhat.com>
>> ---
>> policycoreutils/semanage/seobject.py | 118 +++++++++++++++++------------------
>> 1 file changed, 59 insertions(+), 59 deletions(-)
>>
>> diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py
>> index d29dba5..edd4c83 100644
>> --- a/policycoreutils/semanage/seobject.py
>> +++ b/policycoreutils/semanage/seobject.py
>> @@ -716,7 +716,7 @@ class loginRecords(semanageRecords):
>> def customized(self):
>> l = []
>> ddict = self.get_all(True)
>> - keys = ddict.keys()
>> + keys = list(ddict.keys())
>> keys.sort()
>> for k in keys:
>> l.append("-a -s %s -r '%s' %s" % (ddict[k][0], ddict[k][1], k))
> Isnt it better to do keys = sorted(ddict.keys()) here instead? then the
> explicit call to list() isnt required which would hurt on python3.
You're right. sorted() looks better. I will modify the patch and send it
again.
Michal
>
> -- Jason
prev parent reply other threads:[~2015-07-30 9:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 7:25 Improve Python 3 support in policycoreutils/semanage/seobject.py Michal Srb
2015-07-30 7:25 ` [PATCH] policycoreutils/semanage: improve compatibility with Python 3 in seobject.py Michal Srb
2015-07-30 8:04 ` Jason Zaman
2015-07-30 9:16 ` Michal Srb [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55B9EB5A.5090804@redhat.com \
--to=msrb@redhat.com \
--cc=jason@perfinion.com \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.