We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Test development versions of Python
Uses the `3.11-dev` and `nightly` deadsnakes release streams to test urllib3 against Python versions.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `noxfile.py`
Content:
```
1 import os
2 import shutil
3 import subprocess
4 
5 import nox
6 
7 SOURCE_FILES = [
8     "docs/",
9     "dummyserver/",
10     "src/",
11     "test/",
12     "noxfile.py",
13     "setup.py",
14 ]
15 
16 
17 def tests_impl(
18     session: nox.Session,
19     extras: str = "socks,secure,brotli",
20     byte_string_comparisons: bool = True,
21 ) -> None:
22     # Install deps and the package itself.
23     session.install("-r", "dev-requirements.txt")
24     session.install(f".[{extras}]")
25 
26     # Show the pip version.
27     session.run("pip", "--version")
28     # Print the Python version and bytesize.
29     session.run("python", "--version")
30     session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
31     # Print OpenSSL information.
32     session.run("python", "-m", "OpenSSL.debug")
33 
34     # Inspired from https://github.com/pyca/cryptography
35     # We use parallel mode and then combine here so that coverage.py will take
36     # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py
37     # and collapse them into src/urllib3/__init__.py.
38 
39     session.run(
40         "python",
41         *(("-bb",) if byte_string_comparisons else ()),
42         "-m",
43         "coverage",
44         "run",
45         "--parallel-mode",
46         "-m",
47         "pytest",
48         "-r",
49         "a",
50         "--tb=native",
51         "--no-success-flaky-report",
52         *(session.posargs or ("test/",)),
53         env={"PYTHONWARNINGS": "always::DeprecationWarning"},
54     )
55     session.run("coverage", "combine")
56     session.run("coverage", "report", "-m")
57     session.run("coverage", "xml")
58 
59 
60 @nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy"])
61 def test(session: nox.Session) -> None:
62     tests_impl(session)
63 
64 
65 @nox.session(python=["2.7"])
66 def unsupported_python2(session: nox.Session) -> None:
67     # Can't check both returncode and output with session.run
68     process = subprocess.run(
69         ["python", "setup.py", "install"],
70         env={**session.env},
71         text=True,
72         capture_output=True,
73     )
74     assert process.returncode == 1
75     print(process.stderr)
76     assert "Unsupported Python version" in process.stderr
77 
78 
79 @nox.session(python=["3"])
80 def test_brotlipy(session: nox.Session) -> None:
81     """Check that if 'brotlipy' is installed instead of 'brotli' or
82     'brotlicffi' that we still don't blow up.
83     """
84     session.install("brotlipy")
85     tests_impl(session, extras="socks,secure", byte_string_comparisons=False)
86 
87 
88 def git_clone(session: nox.Session, git_url: str) -> None:
89     session.run("git", "clone", "--depth", "1", git_url, external=True)
90 
91 
92 @nox.session()
93 def downstream_botocore(session: nox.Session) -> None:
94     root = os.getcwd()
95     tmp_dir = session.create_tmp()
96 
97     session.cd(tmp_dir)
98     git_clone(session, "https://github.com/boto/botocore")
99     session.chdir("botocore")
100     session.run("git", "rev-parse", "HEAD", external=True)
101     session.run("python", "scripts/ci/install")
102 
103     session.cd(root)
104     session.install(".", silent=False)
105     session.cd(f"{tmp_dir}/botocore")
106 
107     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
108     session.run("python", "scripts/ci/run-tests")
109 
110 
111 @nox.session()
112 def downstream_requests(session: nox.Session) -> None:
113     root = os.getcwd()
114     tmp_dir = session.create_tmp()
115 
116     session.cd(tmp_dir)
117     git_clone(session, "https://github.com/psf/requests")
118     session.chdir("requests")
119     session.run("git", "apply", f"{root}/ci/requests.patch", external=True)
120     session.run("git", "rev-parse", "HEAD", external=True)
121     session.install(".[socks]", silent=False)
122     session.install("-r", "requirements-dev.txt", silent=False)
123 
124     session.cd(root)
125     session.install(".", silent=False)
126     session.cd(f"{tmp_dir}/requests")
127 
128     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
129     session.run("pytest", "tests")
130 
131 
132 @nox.session()
133 def format(session: nox.Session) -> None:
134     """Run code formatters."""
135     session.install("pre-commit")
136     session.run("pre-commit", "--version")
137 
138     process = subprocess.run(
139         ["pre-commit", "run", "--all-files"],
140         env=session.env,
141         text=True,
142         stdout=subprocess.PIPE,
143         stderr=subprocess.STDOUT,
144     )
145     # Ensure that pre-commit itself ran successfully
146     assert process.returncode in (0, 1)
147 
148     lint(session)
149 
150 
151 @nox.session
152 def lint(session: nox.Session) -> None:
153     session.install("pre-commit")
154     session.run("pre-commit", "run", "--all-files")
155 
156     mypy(session)
157 
158 
159 @nox.session(python="3.8")
160 def mypy(session: nox.Session) -> None:
161     """Run mypy."""
162     session.install("-r", "mypy-requirements.txt")
163     session.run("mypy", "--version")
164     session.run(
165         "mypy",
166         "dummyserver",
167         "noxfile.py",
168         "src/urllib3",
169         "test",
170     )
171 
172 
173 @nox.session
174 def docs(session: nox.Session) -> None:
175     session.install("-r", "docs/requirements.txt")
176     session.install(".[socks,secure,brotli]")
177 
178     session.chdir("docs")
179     if os.path.exists("_build"):
180         shutil.rmtree("_build")
181     session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")
182
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -57,7 +57,7 @@
     session.run("coverage", "xml")
 
 
-@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy"])
+@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy"])
 def test(session: nox.Session) -> None:
     tests_impl(session)

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -57,7 +57,7 @@\n     session.run(\"coverage\", \"xml\")\n \n \n-@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"pypy\"])\n+@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\n def test(session: nox.Session) -> None:\n     tests_impl(session)\n", "issue": "Test development versions of Python\nUses the `3.11-dev` and `nightly` deadsnakes release streams to test urllib3 against Python versions.\n", "before_files": [{"content": "import os\nimport shutil\nimport subprocess\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    # Inspired from https://github.com/pyca/cryptography\n    # We use parallel mode and then combine here so that coverage.py will take\n    # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py\n    # and collapse them into src/urllib3/__init__.py.\n\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        \"-r\",\n        \"a\",\n        \"--tb=native\",\n        \"--no-success-flaky-report\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n    session.run(\"coverage\", \"combine\")\n    session.run(\"coverage\", \"report\", \"-m\")\n    session.run(\"coverage\", \"xml\")\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_python2(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Unsupported Python version\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\"git\", \"apply\", f\"{root}/ci/requests.patch\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"--version\")\n\n    process = subprocess.run(\n        [\"pre-commit\", \"run\", \"--all-files\"],\n        env=session.env,\n        text=True,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n    )\n    # Ensure that pre-commit itself ran successfully\n    assert process.returncode in (0, 1)\n\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}], "after_files": [{"content": "import os\nimport shutil\nimport subprocess\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    # Inspired from https://github.com/pyca/cryptography\n    # We use parallel mode and then combine here so that coverage.py will take\n    # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py\n    # and collapse them into src/urllib3/__init__.py.\n\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        \"-r\",\n        \"a\",\n        \"--tb=native\",\n        \"--no-success-flaky-report\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n    session.run(\"coverage\", \"combine\")\n    session.run(\"coverage\", \"report\", \"-m\")\n    session.run(\"coverage\", \"xml\")\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_python2(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Unsupported Python version\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\"git\", \"apply\", f\"{root}/ci/requests.patch\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"--version\")\n\n    process = subprocess.run(\n        [\"pre-commit\", \"run\", \"--all-files\"],\n        env=session.env,\n        text=True,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n    )\n    # Ensure that pre-commit itself ran successfully\n    assert process.returncode in (0, 1)\n\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}]}