Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mock socket.shutdown for compatibility with urllib3 >= 2.3 #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carlsmedstad
Copy link

Version 2.3.0 of urllib3 gets the attribute socket.shutdown which HTTPretty does no mock. See the following call stack:

/usr/lib/python3.13/site-packages/requests/sessions.py:602: in get
    return self.request("GET", url, **kwargs)
/usr/lib/python3.13/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
/usr/lib/python3.13/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
/usr/lib/python3.13/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
/usr/lib/python3.13/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self._make_request(
/usr/lib/python3.13/site-packages/urllib3/connectionpool.py:534: in _make_request
    response = conn.getresponse()
/usr/lib/python3.13/site-packages/urllib3/connection.py:513: in getresponse
    _shutdown = getattr(self.sock, "shutdown", None)

Version 2.3.0 of urllib3 gets the attribute socket.shutdown which
HTTPretty does no mock. See the following call stack:

    /usr/lib/python3.13/site-packages/requests/sessions.py:602: in get
        return self.request("GET", url, **kwargs)
    /usr/lib/python3.13/site-packages/requests/sessions.py:589: in request
        resp = self.send(prep, **send_kwargs)
    /usr/lib/python3.13/site-packages/requests/sessions.py:703: in send
        r = adapter.send(request, **kwargs)
    /usr/lib/python3.13/site-packages/requests/adapters.py:667: in send
        resp = conn.urlopen(
    /usr/lib/python3.13/site-packages/urllib3/connectionpool.py:787: in urlopen
        response = self._make_request(
    /usr/lib/python3.13/site-packages/urllib3/connectionpool.py:534: in _make_request
        response = conn.getresponse()
    /usr/lib/python3.13/site-packages/urllib3/connection.py:513: in getresponse
        _shutdown = getattr(self.sock, "shutdown", None)
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant