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

Add SSL socket method get_unverified_chain #414

Open
timfel opened this issue Aug 3, 2024 · 2 comments
Open

Add SSL socket method get_unverified_chain #414

timfel opened this issue Aug 3, 2024 · 2 comments

Comments

@timfel
Copy link
Member

timfel commented Aug 3, 2024

This was an experimental API that has become stable with 3.13 and truststore (and thus pip) are relying on it.

@4ku
Copy link

4ku commented Sep 3, 2024

ERROR: Exception:
Traceback (most recent call last):
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
    status = _inner_run()
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
    return self.run(options, args)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
    return func(self, options, args)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 379, in run
    requirement_set = resolver.resolve(
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
    result = self._result = resolver.resolve(
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates:
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__
    return bool(self._sequence)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/functools.py", line 584, in wrapper
    result = user_function(*args, **kwds)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 174, in __bool__
    return any(self)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 162, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 49, in _iter_built
    for version, func in infos:
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 301, in iter_index_candidate_infos
    result = self._finder.find_best_candidate(
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/functools.py", line 560, in wrapper
    result = user_function(*args, **kwds)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 883, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/functools.py", line 560, in wrapper
    result = user_function(*args, **kwds)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 824, in find_all_candidates
    page_candidates = list(page_candidates_it)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/index/sources.py", line 194, in page_candidates
    yield from self._candidates_from_page(self._link)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 784, in process_project_url
    index_response = self._link_collector.fetch_response(project_url)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 448, in fetch_response
    return _get_index_content(location, session=self.session)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 352, in _get_index_content
    resp = _get_simple_response(url, session=session)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 131, in _get_simple_response
    resp = session.get(
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_internal/network/session.py", line 522, in request
    return super().request(method, url, *args, **kwargs)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/cachecontrol/adapter.py", line 76, in send
    resp = super().send(request, stream, timeout, verify, cert, proxies)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_vendor/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_vendor/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/ivan/miniconda3/envs/serl2/lib/python3.10/site-packages/pip/_vendor/truststore/_api.py", line 105, in wrap_socket
    _verify_peercerts(ssl_sock, server_hostname=server_hostname)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_vendor/truststore/_api.py", line 310, in _verify_peercerts
    cert_bytes = _get_unverified_chain_bytes(sslobj)
  File "/home/ivan/miniconda3/envs/serl2/lib/jvm/languages/python/lib/python3.10/site-packages/pip/_vendor/truststore/_api.py", line 292, in _get_unverified_chain_bytes
    unverified_chain = sslobj.get_unverified_chain() or ()  # type: ignore[attr-defined]
AttributeError: '_SSLSocket' object has no attribute 'get_unverified_chain'

@timfel
Copy link
Member Author

timfel commented Sep 4, 2024

Thanks @4ku for the additional report. This is the same issue as the one I linked above, the truststore package has fixed it and pip is already picking up the fix (see pypa/pip#12929) so all we have to do now is wait.

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

No branches or pull requests

2 participants