Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1719145 - python-suds fails to build with Python 3.8 (dictionary keys changed during iteration)
Summary: python-suds fails to build with Python 3.8 (dictionary keys changed during it...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-suds
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Scott Talbert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON38
TreeView+ depends on / blocked
 
Reported: 2019-06-11 07:23 UTC by Miro Hrončok
Modified: 2019-06-11 23:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-11 23:12:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2019-06-11 07:23:25 UTC
python-suds fails to build with Python 3.8.0b1:



=================================== FAILURES ===================================
_ TestRequest.test_string_representation_with_message[-headers1-for a bitch it's haaaard...] _

self = <test_transport.TestRequest object at 0x7f01a168a670>, url = ''
headers = {b'aaa': b'uf-uf'}, message = "for a bitch it's haaaard..."

        @pytest.mark.parametrize(("url", "headers", "message"), (
            ("my URL", {}, ""),
            ("", {"aaa": "uf-uf"}, "for a bitch it's haaaard..."),
            ("http://rumple-fif/muka-laka-hiki", {"uno": "eins", "zwei": "due"},
                """\
    I'm here to kick ass,
    and chew bubble gum...
    and I'm all out of gum."""),
            ("", {}, u("\u0161u\u0107-mu\u0107 pa o\u017Ee\u017Ei.. za 100 "
                "\u20AC\n\nwith multiple\nlines...")),
            ("", {}, "\n\n\n\n\n\n"),
            ("", {}, u("\u4E2D\u539F\u5343\u519B\u9010\u848B"))))
        def test_string_representation_with_message(self, url, headers, message):
>           for key, value in headers.items():
E           RuntimeError: dictionary keys changed during iteration

tests/test_transport.py:143: RuntimeError
_ TestRequest.test_string_representation_with_message[http://rumple-fif/muka-laka-hiki-headers2-I'm here to kick ass,\nand chew bubble gum...\nand I'm all out of gum.] _

self = <test_transport.TestRequest object at 0x7f01a1764c10>
url = 'http://rumple-fif/muka-laka-hiki'
headers = {b'uno': b'eins', b'zwei': b'due'}
message = "I'm here to kick ass,\nand chew bubble gum...\nand I'm all out of gum."

        @pytest.mark.parametrize(("url", "headers", "message"), (
            ("my URL", {}, ""),
            ("", {"aaa": "uf-uf"}, "for a bitch it's haaaard..."),
            ("http://rumple-fif/muka-laka-hiki", {"uno": "eins", "zwei": "due"},
                """\
    I'm here to kick ass,
    and chew bubble gum...
    and I'm all out of gum."""),
            ("", {}, u("\u0161u\u0107-mu\u0107 pa o\u017Ee\u017Ei.. za 100 "
                "\u20AC\n\nwith multiple\nlines...")),
            ("", {}, "\n\n\n\n\n\n"),
            ("", {}, u("\u4E2D\u539F\u5343\u519B\u9010\u848B"))))
        def test_string_representation_with_message(self, url, headers, message):
>           for key, value in headers.items():
E           RuntimeError: dictionary keys changed during iteration

tests/test_transport.py:143: RuntimeError



This is a new thing in 3.8, see https://github.com/python/cpython/pull/12596

A fix is usually to iterate over a copy (unless the code does some magical hacks).

Logs: https://copr-be.cloud.fedoraproject.org/results/@python/python3.8/fedora-rawhide-x86_64/00934040-python-suds/

Comment 1 Miro Hrončok 2019-06-11 07:29:48 UTC
Something like:

--- a/tests/test_transport.py   Mon Jul 27 11:08:20 2015 +0200
+++ b/tests/test_transport.py   Tue Jun 11 09:29:31 2019 +0200
@@ -140,7 +140,7 @@
         ("", {}, "\n\n\n\n\n\n"),
         ("", {}, u("\u4E2D\u539F\u5343\u519B\u9010\u848B"))))
     def test_string_representation_with_message(self, url, headers, message):
-        for key, value in headers.items():
+        for key, value in list(headers.items()):
             old_key = key
             if isinstance(key, text_type):
                 key = key.encode("utf-8")

Comment 2 Scott Talbert 2019-06-11 13:04:44 UTC
Dangit, I forgot to test 3.8.  Thanks.


Note You need to log in before you can comment on or make changes to this bug.