Loads of unit test failures in Python 3.5: OrderedDict mutated during iteration

Bug #1502232 reported by Thomas Goirand on 2015-10-02
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
keystoneauth
High
Corey Bryant

Bug Description

Building the python-keystoneauth1 in Debian exposed 156 (out of 244) unit test failures when running under Python 3.5. Here's an example stack dump:

FAIL: keystoneauth1.tests.unit.test_token_endpoint.TokenEndpointTest.test_basic_endpoint_case
keystoneauth1.tests.unit.test_token_endpoint.TokenEndpointTest.test_basic_endpoint_case
----------------------------------------------------------------------
_StringException: Empty attachments:
  pythonlogging:''

Traceback (most recent call last):
  File "/home/zigo/sources/openstack/liberty/python-keystoneauth1/build-area/python-keystoneauth1-1.1.0/keystoneauth1/tests/unit/test_token_endpoint.py", line 40, in test_basic_endpoint_case
    s = session.Session(auth=a)
  File "/home/zigo/sources/openstack/liberty/python-keystoneauth1/build-area/python-keystoneauth1-1.1.0/keystoneauth1/_utils.py", line 180, in inner
    return func(*args, **kwargs)
  File "/home/zigo/sources/openstack/liberty/python-keystoneauth1/build-area/python-keystoneauth1-1.1.0/keystoneauth1/session.py", line 107, in __init__
    for scheme in session.adapters.keys():
RuntimeError: OrderedDict mutated during iteration

Changed in keystoneauth:
importance: Undecided → High

Fix proposed to branch: master
Review: https://review.openstack.org/258594

Changed in keystoneauth:
assignee: nobody → Corey Bryant (corey.bryant)
status: New → In Progress

Reviewed: https://review.openstack.org/258594
Committed: https://git.openstack.org/cgit/openstack/keystoneauth/commit/?id=87d8ab5b88c7ec37ec525a3f4d2b647959a9efcf
Submitter: Jenkins
Branch: master

commit 87d8ab5b88c7ec37ec525a3f4d2b647959a9efcf
Author: Corey Bryant <email address hidden>
Date: Wed Dec 16 10:27:25 2015 -0500

    Iterate over copy of session.adapters keys in Python2/3

    Iterate over a copy of session.adapters keys in both Python 2.x and
    Python 3.x. In Python 3.5+, keys() is not a copy, and therefore
    items can't be popped from it while iterating.
        RuntimeError: OrderedDict mutated during iteration
        https://bugs.python.org/issue24369
        https://hg.python.org/cpython/rev/0d8679858272

    Change-Id: I038f1e8261fa6b29401e6c64db95f7480b35a598
    Closes-Bug: #1502232

Changed in keystoneauth:
status: In Progress → Fix Released

This issue was fixed in the openstack/keystoneauth 2.2.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.