Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compatibility issue with urllib3 #547

Open
JaeyongYoo opened this issue Nov 6, 2023 · 0 comments
Open

Compatibility issue with urllib3 #547

JaeyongYoo opened this issue Nov 6, 2023 · 0 comments
Assignees
Labels
Bug Confirmed bug

Comments

@JaeyongYoo
Copy link

JaeyongYoo commented Nov 6, 2023

We are using the following combination (rpyc+openapi+urllib3) for processing REST requests and ran into this error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/rpyc/core/protocol.py", line 359, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/rpyc/core/protocol.py", line 837, in _handle_call
    return obj(*args, **dict(kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/cna/cna-nf_sim/nf_sim/lib/python3/openapi/rest.py", line 502, in POST
    return self.request("POST",
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/cna/cna-nf_sim/nf_sim/lib/python3/openapi/rest.py", line 315, in request
    r = self.pool_manager.request(method,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/_request_methods.py", line 121, in request
    return self.request_encode_body(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/_request_methods.py", line 196, in request_encode_body
    extra_kw: dict[str, typing.Any] = {"headers": HTTPHeaderDict(headers)}
                                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/_collections.py", line 252, in __init__
    self.extend(headers)
  File "/usr/local/lib/python3.11/site-packages/urllib3/_collections.py", line 370, in extend
    for key, value in other:
        ^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

After some debugging, the issue is due to the RPYC's custom type (iterable tuple) is not really supporting the unpacking with the following syntax

for key, value in other:

which is causing the error "Too many values to unpack" where the iterable tuple can be unpacked with single item.
You can check the urllib3 source code for this part here: https://github.com/urllib3/urllib3/blob/main/src/urllib3/_collections.py#L355

Would you be possible to resolve this issue?

@comrumino comrumino self-assigned this Jan 10, 2024
@comrumino comrumino added the Bug Confirmed bug label Jan 10, 2024
comrumino added a commit that referenced this issue Jan 10, 2024
… any a fix for #355 and #547 will be a break-change/major-release.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants