failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · psf/requests
Fix empty netrc entry usage
Prior to Python 3.11, a netrc entry without a username, account, or password entry was treated as malformed and raised a `NetrcParseError` disabling usage. For 3.11+, it now returns an empty tuple `('', '' ,'')` instead. That results in Requests sending an empty entry (`:`) for the value to encode in an Authorization header.
This PR brings Requests back to its intended behavior of ignoring these profiles. Anyone who may have some use case for this, we did not to intend to support this behavior. If you need it going forward, you can pass `auth=('', '')` with your request.| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
..s................F
=================================== FAILURES ===================================
___________ TestGetNetrcAuth.test_empty_default_credentials_ignored ____________
self = <tests.test_utils.TestGetNetrcAuth object at 0x1055e29e0>
tmp_path = PosixPath('/private/tmp/swe_work/baseline_full_v2/requests_7205/b/tmp/pytest-of-jp/pytest-0/test_empty_default_credentials0')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x105815130>
def test_empty_default_credentials_ignored(self, tmp_path, monkeypatch):
"""Empty default credentials should not be returned."""
netrc_path = tmp_path / ".netrc"
monkeypatch.setenv("NETRC", str(netrc_path))
with open(netrc_path, "w") as f:
f.write("machine example.com login user password pass\ndefault\n")
auth = get_netrc_auth("http://httpbin.org/")
> assert auth is None
E AssertionError: assert ('', '') is None
tests/test_utils.py:181: 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")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 18 passed, 1 skipped, 1 warning in 0.10s
[2026-09-23 20:58:11,827] WARNING in core: flasgger is not installed; serving the static landing page at / and skipping the Swagger UI and /spec.json.