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
Provenance
- Commit
7c9db49- Tree
e5f3e26- Author
Hugo van Kemenade <hugovk@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
59df819
6 files changed+17 added−16 removed
modified:.github/workflows/publish.yml+1 added-1 removed
12 unmodified lines131415161717181920218 unmodified lines12 unmodified lines environment: name: deploy
steps: - uses: "actions/checkout@v3" - uses: "actions/checkout@v4" - uses: "actions/setup-python@v4" with: python-version: 3.8 - name: "Install dependencies"8 unmodified linesmodified:.github/workflows/test-suite.yml+3 added-2 removed
12 unmodified lines1314151617171819202021222324252627286 unmodified lines12 unmodified lines runs-on: "ubuntu-latest"
strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps: - uses: "actions/checkout@v3" - uses: "actions/checkout@v4" - uses: "actions/setup-python@v4" with: python-version: "${{ matrix.python-version }}" allow-prereleases: true - name: "Install dependencies" run: "scripts/install" - name: "Run linting checks" run: "scripts/check"6 unmodified linesmodified:httpx/_compat.py+1 added-3 removed
14 unmodified lines15 import brotli16 except ImportError:17 brotli = None18 19-if sys.version_info >= (3, 10) or (20- sys.version_info >= (3, 8) and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0, 7)21-):19+if sys.version_info >= (3, 10) or ssl.OPENSSL_VERSION_INFO >= (1, 1, 0, 7):20 21 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, however18 unmodified linesmodified:httpx/_config.py+7 added-10 removed
1 import logging2 import os3 import ssl4-import sys4 import typing5 from pathlib import Path6 7 import certifi118 unmodified lines126 context.check_hostname = True127 128 # 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+ pass134 135 # Disable using 'commonName' for SSLContext.check_hostname136 # when the 'subjectAltName' extension isn't available.137 try:27 unmodified lines165 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)168 171- 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 = keylogfile172 173 return context174 175 def _load_client_certs(self, ssl_context: ssl.SSLContext) -> None:193 unmodified linesmodified:CHANGELOG.md+4 added
4 unmodified lines5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).6 7 ## Unreleased8 9+### Added10+11+* Add support for Python 3.12. (#2854)12+13 ### Fixed14 15 * Raise `ValueError` on `Response.encoding` being set after `Response.text` has been accessed. (#2852)16 1031 unmodified linesmodified:pyproject.toml+1 added
22 unmodified lines23242526272829303196 unmodified lines22 unmodified lines "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP",]dependencies = [ "certifi",96 unmodified lines