← baseline_full_v2

requests_7427

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

Task input

Port bpo-39057 to Requests

This PR ports a [fix](https://bugs.python.org/issue39057) from CPython to constrain no_proxy behavior to domain boundaries. This was originally undefined behavior when Requests implemented `no_proxy` support but has since had bug fixes released in both CPython and Curl. We'll follow suit to conform with ecosystem expectations and resolve long standing issue #4795.

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
..s..................................................................... [ 31%]
........................................................................ [ 62%]
.................................................................F
=================================== FAILURES ===================================
_ test_should_bypass_proxies_no_proxy_domain_boundary[http://prelocalhost/-False] _

url = 'http://prelocalhost/', expected = False

    @pytest.mark.parametrize(
        "url, expected",
        (
            ("http://localhost/", True),
            ("http://anotherdomain.com:8888/", True),
            ("http://newdomain.com:1234/", True),
            ("http://www.newdomain.com:1234/", True),
            ("http://foo.d.o.t/", True),
            ("http://d.o.t/", True),
            ("http://prelocalhost/", False),
            ("http://newdomain.com/", False),
            ("http://newdomain.com:1235/", False),
        ),
    )
    def test_should_bypass_proxies_no_proxy_domain_boundary(url, expected):
        """Ensure no_proxy matching respects domain boundaries and does not
        greedily match domains that merely endswith the no_proxy entry.
        See CPython bpo-39057.
        """
        no_proxy = "localhost, anotherdomain.com, newdomain.com:1234, .d.o.t"
>       assert should_bypass_proxies(url, no_proxy=no_proxy) == expected
E       AssertionError: assert True == False
E        +  where True = should_bypass_proxies('http://prelocalhost/', no_proxy='localhost, anotherdomain.com, newdomain.com:1234, .d.o.t')

tests/test_utils.py:867: 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_utils.py::TestContentEncodingDetection::test_none
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta charset="UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<?xml version="1.0" encoding="UTF-8"?>]
tests/test_utils.py::TestContentEncodingDetection::test_precedence
  /tmp/swe_work/baseline_full_v2/requests_7427/b/workspace/src/requests/utils.py:527: DeprecationWarning: In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 208 passed, 1 skipped, 7 warnings in 0.18s
[2026-09-23 20:58:10,458] WARNING in core: flasgger is not installed; serving the static landing page at / and skipping the Swagger UI and /spec.json.