yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #53989
[Bug 1583419] Re: Make dict.keys() PY3 compatible
Reviewed: https://review.openstack.org/332661
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=31ed226a67ff6b2320f605ce436658312cf0c701
Submitter: Jenkins
Branch: master
commit 31ed226a67ff6b2320f605ce436658312cf0c701
Author: Bin Zhou <zhou.bin9@xxxxxxxxxx>
Date: Wed Jun 22 16:35:12 2016 +0800
Refactor usage of dict.values()[0]
The dict.values()[0] will raise a TypeError in PY3, as dict.values()
doesn't return a list any more in PY3 but a view of list. This patch
is to fix this bug by refactoring the relevant code.
Change-Id: I4362a22322807eda8d795d68395445d53ab60ad4
Closes-Bug: #1583419
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1583419
Title:
Make dict.keys() PY3 compatible
Status in Cinder:
Fix Released
Status in neutron:
Fix Released
Status in python-cinderclient:
Fix Released
Status in python-manilaclient:
Fix Released
Status in python-troveclient:
Fix Released
Status in Rally:
Fix Released
Status in tacker:
Fix Released
Status in watcher:
In Progress
Bug description:
In PY3, dict.keys() will return a view of list but not a list anymore, i.e.
$ python3.4
Python 3.4.3 (default, Mar 31 2016, 20:42:37)
>>> body={"11":"22"}
>>> body[body.keys()[0]]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'dict_keys' object does not support indexing
so for py3 compatible we should change it as follows:
>>> body[list(body.keys())[0]]
'22'
To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1583419/+subscriptions