failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · psf/requests
Add hasattr checks for remaining protocol isinstance checks This PR is a successor to #7502. The proxied-read case appears in the standard library which points to it being a pretty well established pattern. A quick search shows there are two other places this was missed in. Rather than put `or hasattr(data, "read")` everywhere we use want to use `SupportsRead`, this combines it into a single check that scopes typing correctly for proxy objects. That should hopefully avoid missing it for future checks as well.
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
........................................................................ [ 21%]
.................................................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
.....F
=================================== FAILURES ===================================
________________ TestRequests.test_post_getattr_proxy_read_only ________________
self = <tests.test_requests.TestRequests object at 0x1045dcaa0>
httpbin = <function prepare_url.<locals>.inner at 0x105ff1e40>
def test_post_getattr_proxy_read_only(self, httpbin):
class ReadProxy:
def __init__(self):
self._file = io.BytesIO(b"streamed body")
def __getattr__(self, name):
if name == "__iter__":
raise AttributeError(name)
return getattr(self._file, name)
r = requests.post(httpbin("post"), data=ReadProxy())
assert r.status_code == 200
> assert r.json()["data"] == "streamed body"
E AssertionError: assert '' == 'streamed body'
E
E - streamed body
tests/test_requests.py:1114: AssertionError
----------------------------- Captured stderr call -----------------------------
127.0.0.1 - - [23/Sep/2026 20:58:08] "POST /post HTTP/1.1" 200 444
=============================== 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_7505/b/workspace/src/requests/auth.py:45: 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_7505/b/workspace/src/requests/auth.py:55: 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_7505/b/workspace/src/requests/auth.py:45: 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_7505/b/workspace/src/requests/auth.py:55: 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, 126 passed, 1 skipped, 9 warnings in 1.05s
[2026-09-23 20:58:08,134] 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:58:08] "GET /cookies HTTP/1.1" 200 40
127.0.0.1 - - [23/Sep/2026 20:58:08] "GET /digest-auth/auth/user/pass/SHA-512 HTTP/1.1" 401 0