Skip to content

Commit

Permalink
Remove deprecated support for ssl=None (#8048)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Jan 21, 2024
1 parent e8339e7 commit f530e92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGES/8048.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed deprecated support for `ssl=None` -- by :user:`Dreamsorcerer`
13 changes: 2 additions & 11 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ async def _request(
proxy_auth=proxy_auth,
timer=timer,
session=self,
ssl=ssl if ssl is not None else True, # type: ignore[redundant-expr]
ssl=ssl,
server_hostname=server_hostname,
proxy_headers=proxy_headers,
traces=traces,
Expand Down Expand Up @@ -724,7 +724,7 @@ def ws_connect(
headers=headers,
proxy=proxy,
proxy_auth=proxy_auth,
ssl=ssl if ssl is not None else True, # type: ignore[redundant-expr]
ssl=ssl,
server_hostname=server_hostname,
proxy_headers=proxy_headers,
compress=compress,
Expand Down Expand Up @@ -805,15 +805,6 @@ async def _ws_connect(
extstr = ws_ext_gen(compress=compress)
real_headers[hdrs.SEC_WEBSOCKET_EXTENSIONS] = extstr

# For the sake of backward compatibility, if user passes in None, convert it to True
if ssl is None:
warnings.warn(
"ssl=None is deprecated, please use ssl=True",
DeprecationWarning,
stacklevel=2,
)
ssl = True

if not isinstance(ssl, SSL_ALLOWED_TYPES):
raise TypeError(
"ssl should be SSLContext, Fingerprint, or bool, "
Expand Down
6 changes: 3 additions & 3 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def check(self, transport: asyncio.Transport) -> None:


if ssl is not None:
SSL_ALLOWED_TYPES = (ssl.SSLContext, bool, Fingerprint, type(None))
SSL_ALLOWED_TYPES = (ssl.SSLContext, bool, Fingerprint)
else: # pragma: no cover
SSL_ALLOWED_TYPES = (bool, type(None))
SSL_ALLOWED_TYPES = (bool,)


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -247,7 +247,7 @@ def __init__(
real_response_class = response_class
self.response_class: Type[ClientResponse] = real_response_class
self._timer = timer if timer is not None else TimerNoop()
self._ssl = ssl if ssl is not None else True # type: ignore[redundant-expr]
self._ssl = ssl
self.server_hostname = server_hostname

if loop.get_debug():
Expand Down

0 comments on commit f530e92

Please sign in to comment.