← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1583419] Re: Make dict.keys() PY3 compatible

 

Reviewed:  https://review.openstack.org/332081
Committed: https://git.openstack.org/cgit/openstack/python-troveclient/commit/?id=dabe872cbcfd815c63fe5816858923b1e908eefe
Submitter: Jenkins
Branch:    master

commit dabe872cbcfd815c63fe5816858923b1e908eefe
Author: dineshbhor <dinesh.bhor@xxxxxxxxxxx>
Date:   Tue Jun 21 16:15:41 2016 +0530

    Make dict.keys() PY3 compatible
    
    The dict.keys()[0] will raise a TypeError in PY3,
    as dict.keys() doesn't return a list any more in PY3
    but a view of list.
    
    Change-Id: Id9c7d3725c01bd0a193d8fc6705443efe9c25c34
    Partially implements: blueprint trove-python3
    Closes-Bug: #1583419


** Changed in: python-troveclient
       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 Ceilometer:
  In Progress
Status in Cinder:
  In Progress
Status in neutron:
  In Progress
Status in OpenStack Compute (nova):
  New
Status in python-ceilometerclient:
  New
Status in python-cinderclient:
  Fix Released
Status in python-glanceclient:
  New
Status in python-heatclient:
  New
Status in python-manilaclient:
  In Progress
Status in python-troveclient:
  Fix Released
Status in Rally:
  Fix Released
Status in tempest:
  New

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/ceilometer/+bug/1583419/+subscriptions