← baseline_full_v2

requests_6589

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · psf/requests

Task input

Enhance `super_len` to count encoded bytes for str

This is a possible fix for issue #6586.

I am not at all confident that this is an appropriate change for Requests. All of the unit tests pass locally for me (specifically `make ci`).

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
........................................................................ [ 22%]
...............................................spytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1032)
attempting to ignore so the rest of the tests can run
........................ [ 44%]
............................................................F
=================================== FAILURES ===================================
________ TestRequests.test_content_length_for_string_data_counts_bytes _________

self = <tests.test_requests.TestRequests object at 0x105bde3f0>
httpbin = <function prepare_url.<locals>.inner at 0x107500680>

    def test_content_length_for_string_data_counts_bytes(self, httpbin):
        data = "This is a string containing multi-byte UTF-8 ☃️"
        length = str(len(data.encode("utf-8")))
        req = requests.Request("POST", httpbin("post"), data=data)
        p = req.prepare()
    
>       assert p.headers["Content-Length"] == length
E       AssertionError: assert '47' == '51'
E         
E         - 51
E         + 47

tests/test_requests.py:1826: AssertionError
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464
  /Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464: PytestConfigWarning: Unknown config option: timeout
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /tmp/swe_work/baseline_full_v2/requests_6589/b/workspace/src/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (42) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /tmp/swe_work/baseline_full_v2/requests_6589/b/workspace/src/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'int'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /tmp/swe_work/baseline_full_v2/requests_6589/b/workspace/src/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /tmp/swe_work/baseline_full_v2/requests_6589/b/workspace/src/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'NoneType'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 203 passed, 1 skipped, 9 warnings in 1.26s
[2026-09-23 20:59:34,357] WARNING in core: flasgger is not installed; serving the static landing page at / and skipping the Swagger UI and /spec.json.
127.0.0.1 - - [23/Sep/2026 20:59:34] "GET /digest-auth/auth/user/pass/SHA-512 HTTP/1.1" 200 46
127.0.0.1 - - [23/Sep/2026 20:59:35] "GET /get?foo=f%C3%B8%C3%B8 HTTP/1.1" 200 320
127.0.0.1 - - [23/Sep/2026 20:59:35] "GET /get HTTP/1.1" 200 285