Skip to content
Myr

Add support for Python 3.12 (#2854)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add support for Python 3.12 * Bump GitHub Actions * Remove redundant version checks * Add CHANGELOG entry

authored by Hugo van Kemenade · committed by GitHub · parent 59df819 · Browse files · 6 files+17 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+17 added−16 removed

  • other:+17 added−16 removed

6 files+17 added−16 removed

modified:.github/workflows/publish.yml+1 added-1 removed
modified:.github/workflows/test-suite.yml+3 added-2 removed
modified:httpx/_compat.py+1 added-3 removed
14 unmodified lines
15 import brotli16 except ImportError:17 brotli = None1819if sys.version_info >= (3, 10) or (20 sys.version_info >= (3, 8) and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0, 7)21):19if sys.version_info >= (3, 10) or ssl.OPENSSL_VERSION_INFO >= (1, 1, 0, 7):2021 def set_minimum_tls_version_1_2(context: ssl.SSLContext) -> None:22 # The OP_NO_SSL* and OP_NO_TLS* become deprecated in favor of23 # 'SSLContext.minimum_version' from Python 3.7 onwards, however
18 unmodified lines
modified:httpx/_config.py+7 added-10 removed
1import logging2import os3import ssl4import sys4import typing5from pathlib import Path67import certifi
118 unmodified lines
126 context.check_hostname = True127128 # Signal to server support for PHA in TLS 1.3. Raises an129 # AttributeError if only read-only access is implemented.131 if sys.version_info >= (3, 8): # pragma: no cover132 try:133 context.post_handshake_auth = True134 except AttributeError: # pragma: no cover135 pass130 try:131 context.post_handshake_auth = True132 except AttributeError: # pragma: no cover133 pass134135 # Disable using 'commonName' for SSLContext.check_hostname136 # when the 'subjectAltName' extension isn't available.137 try:
27 unmodified lines
165 if ssl.HAS_ALPN:166 alpn_idents = ["http/1.1", "h2"] if self.http2 else ["http/1.1"]167 context.set_alpn_protocols(alpn_idents)168171 if sys.version_info >= (3, 8): # pragma: no cover172 keylogfile = os.environ.get("SSLKEYLOGFILE")173 if keylogfile and self.trust_env:174 context.keylog_filename = keylogfile169 keylogfile = os.environ.get("SSLKEYLOGFILE")170 if keylogfile and self.trust_env:171 context.keylog_filename = keylogfile172173 return context174175 def _load_client_certs(self, ssl_context: ssl.SSLContext) -> None:
193 unmodified lines
modified:CHANGELOG.md+4 added
4 unmodified lines
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).67## Unreleased89### Added1011* Add support for Python 3.12. (#2854)1213### Fixed1415* Raise `ValueError` on `Response.encoding` being set after `Response.text` has been accessed. (#2852)16
1031 unmodified lines
modified:pyproject.toml+1 added