Repository: aaugustin/websockets
Pull request #1316 (2023-03-29 05:47:42)

Bump pypa/cibuildwheel from 2.11.1 to 2.12.1
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.11.1 to 2.12.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pypa/cibuildwheel/releases">pypa/cibuildwheel's releases</a>.</em></p>
<blockquote>
<h2>v2.12.1</h2>
<ul>
<li>🐛 Fix a bug that prevented the use of CIBW_CONFIG_SETTINGS with the 'pip' build backend. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1430">#1430</a>)</li>
</ul>
<h2>v2.12.0</h2>
<ul>
<li>✨ Adds support for PyPy arm64 wheels. This means that you can build PyPy wheels for Apple Silicon machines. Cross-compilation is not supported for these wheels, so you'll have to build on an Apple Silicon machine. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1372">#1372</a>)</li>
<li>🛠 Pinned version updates, including PyPy to v7.3.11 and setuptools to 66.0.0.</li>
</ul>
<h2>v2.11.4</h2>
<ul>
<li>🐛 Fix a bug that caused missing wheels on Windows when a test was skipped using CIBW_TEST_SKIP (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1377">#1377</a>)</li>
<li>🛠 Updates CPython 3.11 to 3.11.1 (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1371">#1371</a>)</li>
<li>🛠 Updates PyPy 3.7 to 3.7.10, except on macOS which remains on 7.3.9 due to a bug. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1371">#1371</a>)</li>
<li>📚 Added a reference to abi3audit to the docs (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1347">#1347</a>)</li>
</ul>
<h2>v2.11.3</h2>
<ul>
<li>✨ Improves the 'build options' log output that's printed at the start of each run (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1352">#1352</a>)</li>
<li>✨ Added a friendly error message to a common misconfiguration of the <code>CIBW_TEST_COMMAND</code> option - not specifying path using the <code>{project}</code> placeholder (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1336">#1336</a>)</li>
<li>🛠 The GitHub Action now uses Powershell on Windows to avoid occasional incompabilities with bash (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1346">#1346</a>)</li>
</ul>
<h2>v2.11.2</h2>
<ul>
<li>🛠 Updates CPython 3.11 to 3.11.0 - final release (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1327">#1327</a>)</li>
<li>🛠 Simplify the default macOS repair command (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1322">#1322</a>)</li>
<li>🛠 Fix the default <code>MACOSX_DEPLOYMENT_TARGET</code> on arm64 (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1312">#1312</a>)</li>
<li>🛠 Hide irrelevant pip warnings on linux (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1311">#1311</a>)</li>
<li>🐛 Fix a bug that caused the stdout and stderr of commands in containers to be in the wrong order Previously, stdout could appear after stderr. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1324">#1324</a>)</li>
<li>📚 Added <a href="https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64">a FAQ entry</a> describing how to perform native builds of CPython 3.8 wheels on Apple Silicon. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1323">#1323</a>)</li>
<li>📚 Other docs improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md">pypa/cibuildwheel's changelog</a>.</em></p>
<blockquote>
<h3>v2.12.1</h3>
<p><em>11 March 2023</em></p>
<ul>
<li>🐛 Fix a bug that prevented the use of CIBW_CONFIG_SETTINGS with the 'pip' build backend. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1430">#1430</a>)</li>
</ul>
<h3>v2.12.0</h3>
<p><em>16 Jan 2023</em></p>
<ul>
<li>✨ Adds support for PyPy arm64 wheels. This means that you can build PyPy wheels for Apple Silicon machines. Cross-compilation is not supported for these wheels, so you'll have to build on an Apple Silicon machine. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1372">#1372</a>)</li>
<li>🛠 Pinned version updates, including PyPy to v7.3.11 and setuptools to 66.0.0.</li>
</ul>
<h3>v2.11.4</h3>
<p><em>24 Dec 2022</em></p>
<ul>
<li>🐛 Fix a bug that caused missing wheels on Windows when a test was skipped using CIBW_TEST_SKIP (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1377">#1377</a>)</li>
<li>🛠 Updates CPython 3.11 to 3.11.1 (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1371">#1371</a>)</li>
<li>🛠 Updates PyPy to 7.3.10, except on macOS which remains on 7.3.9 due to a bug on that platform. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1371">#1371</a>)</li>
<li>📚 Added a reference to abi3audit to the docs (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1347">#1347</a>)</li>
</ul>
<h3>v2.11.3</h3>
<p><em>5 Dec 2022</em></p>
<ul>
<li>✨ Improves the 'build options' log output that's printed at the start of each run (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1352">#1352</a>)</li>
<li>✨ Added a friendly error message to a common misconfiguration of the <code>CIBW_TEST_COMMAND</code> option - not specifying path using the <code>{project}</code> placeholder (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1336">#1336</a>)</li>
<li>🛠 The GitHub Action now uses Powershell on Windows to avoid occasional incompabilities with bash (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1346">#1346</a>)</li>
</ul>
<h3>v2.11.2</h3>
<p><em>26 October 2022</em></p>
<ul>
<li>🛠 Updates CPython 3.11 to 3.11.0 - final release (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1327">#1327</a>)</li>
<li>🛠 Simplify the default macOS repair command (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1322">#1322</a>)</li>
<li>🛠 Fix the default <code>MACOSX_DEPLOYMENT_TARGET</code> on arm64 (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1312">#1312</a>)</li>
<li>🛠 Hide irrelevant pip warnings on linux (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1311">#1311</a>)</li>
<li>🐛 Fix a bug that caused the stdout and stderr of commands in containers to be in the wrong order Previously, stdout could appear after stderr. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1324">#1324</a>)</li>
<li>📚 Added <a href="https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64">a FAQ entry</a> describing how to perform native builds of CPython 3.8 wheels on Apple Silicon. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1323">#1323</a>)</li>
<li>📚 Other docs improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/cibuildwheel/commit/02ad79a31bf7aa0eee07f690509048d2fb9fd445"><code>02ad79a</code></a> Bump version: v2.12.1</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/1d6ee75d21e2d39eeff59a101efbdff3f926060d"><code>1d6ee75</code></a> Merge pull request <a href="https://redirect.github.com/pypa/cibuildwheel/issues/1430">#1430</a> from henryiii/henryiii/fix/pipconfigopts</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/0b1b539450d86f7be21182225467c24303b687f7"><code>0b1b539</code></a> [Bot] Update dependencies (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/1425">#1425</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/2e48667e29fa128d96738dd6bb585aaab232b580"><code>2e48667</code></a> refactor: use frontend instead of plural</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/c6818608d23a2f54b26e48b22c28fceb40ce2c57"><code>c681860</code></a> fix: pip config options were broken</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/7190b1a6a7be78508bc9a75badd370ec33018880"><code>7190b1a</code></a> Merge pull request <a href="https://redirect.github.com/pypa/cibuildwheel/issues/1428">#1428</a> from henryiii/henryiii/ci/appveyor</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/16380b855562429b51e9ac36f6dd57094121c4b4"><code>16380b8</code></a> Update CI table</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/94efa61f7667e9451d24b5ce8265b0afaaead76a"><code>94efa61</code></a> ci: fix appveyor (Python 3.8+ needed for macOS)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/acdbe87e3d002598b10435bb6f17bae758418ba8"><code>acdbe87</code></a> Merge pull request <a href="https://redirect.github.com/pypa/cibuildwheel/issues/1427">#1427</a> from pypa/pre-commit-ci-update-config</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/49b736d1c725bda880a31df86e46a3d1a09d92b8"><code>49b736d</code></a> [pre-commit.ci] pre-commit autoupdate</li>
<li>Additional commits viewable in <a href="https://github.com/pypa/cibuildwheel/compare/v2.11.1...v2.12.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pypa/cibuildwheel&package-manager=github_actions&previous-version=2.11.1&new-version=2.12.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
index 0013ad1..90a0758 100644
--- a/.github/workflows/wheels.yml
+++ b/.github/workflows/wheels.yml
@@ -48,7 +48,7 @@ jobs:
       with:
         platforms: all
     - name: Build wheels
-      uses: pypa/cibuildwheel@v2.11.1
+      uses: pypa/cibuildwheel@v2.12.1
       env:
         CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
         CIBW_ARCHS_LINUX: "auto aarch64"
diff --git a/docs/project/changelog.rst b/docs/project/changelog.rst
index 95193e7..5a3afcc 100644
--- a/docs/project/changelog.rst
+++ b/docs/project/changelog.rst
@@ -82,6 +82,12 @@ New features
 * Added :attr:`~server.ServerProtocol.select_subprotocol` to customize
   negotiation of subprotocols in the Sans-I/O layer.
 
+Improvements
+............
+
+* Set ``server_hostname`` automatically on TLS connections when providing a
+  ``sock`` argument to :func:`~sync.client.connect`.
+
 10.4
 ----
 
diff --git a/src/websockets/legacy/client.py b/src/websockets/legacy/client.py
index aa71ddb..f2d2c72 100644
--- a/src/websockets/legacy/client.py
+++ b/src/websockets/legacy/client.py
@@ -530,6 +530,8 @@ class Connect:
             else:
                 # If sock is given, host and port shouldn't be specified.
                 host, port = None, None
+                if kwargs.get("ssl"):
+                    kwargs.setdefault("server_hostname", wsuri.host)
             # If host and port are given, override values from the URI.
             host = kwargs.pop("host", host)
             port = kwargs.pop("port", port)


Test patch:
diff --git a/tests/legacy/test_client_server.py b/tests/legacy/test_client_server.py
index d923385..2da2030 100644
--- a/tests/legacy/test_client_server.py
+++ b/tests/legacy/test_client_server.py
@@ -428,11 +428,7 @@ class CommonClientServerTests:
             self.assertFalse(client_socket.used_for_read)
             self.assertFalse(client_socket.used_for_write)
 
-            with self.temp_client(
-                sock=client_socket,
-                # "You must set server_hostname when using ssl without a host"
-                server_hostname="localhost" if self.secure else None,
-            ):
+            with self.temp_client(sock=client_socket):
                 self.loop.run_until_complete(self.client.send("Hello!"))
                 reply = self.loop.run_until_complete(self.client.recv())
                 self.assertEqual(reply, "Hello!")