We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`python_requires` prevents install of recent urllib3 when using Poetry
### Subject

re: https://github.com/urllib3/urllib3/pull/1309#issuecomment-356650894

I no longer see the suggestion of including `<4` in the link referenced earlier in that PR (content relocated to https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires). Its inclusion is causing `1.22` to be installed.

I use `poetry` to manage dependencies for https://github.com/cj81499/advent-of-code, and today I got a dependabot alert for urllib3 (CVE-2018-20060).

I tried a `poetry update`, but poetry did not update urllib. `poetry add urllib3@latest` revealed the problem.

```command
> poetry add urllib3@latest
Using version ^1.26.12 for urllib3

Updating dependencies
Resolving dependencies... (0.0s)

The current project's Python requirement (>=3.9) is not compatible with some of the required packages Python requirement:
  - urllib3 requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4, so it will not be satisfied for Python >=4

Because urllib3 (1.26.12) requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4
 and no versions of urllib3 match >1.26.12,<2.0.0, urllib3 is forbidden.
So, because aoc-cj depends on urllib3 (^1.26.12), version solving failed.

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
    
    For urllib3, a possible solution would be to set the `python` property to ">=3.9,<4"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers
```

As a result of this change, I've been quietly stuck on `urllib3 v1.22` without even realizing it.

As suggested by poetry, I've changed _my_ python requirement from ">=3.9" to ">=3.9,<4" to be able to update, but I'm not sure there's a good reason to restrict the supported python versions to `<4`. Like I mentioned earlier, it seems this is no longer recommended by the Python docs.

In addition, since it didn't set a `python_requires`, a (future) Python 4 user might try to install urllib3 and get `v1.22`(!), which seems like pretty undesirable behavior to me.

_Originally posted by @cj81499 in https://github.com/urllib3/urllib3/issues/1309#issuecomment-1301625738_

### Environment

poetry 1.2.2

OS macOS-12.6-x86_64-i386-64bit
Python 3.9.15
urllib3 1.22

### Steps to Reproduce

- Install poetry
- Clone https://github.com/cj81499/advent-of-code
- Checkout commit `a8fecd3`
- run `poetry install`
- run `poetry show urllib3`
- Observe that version 1.22 is installed

### Expected Behavior

Latest urllib3 (`1.26.12` at time of writing) is installed

### Actual Behavior

urllib3 `1.22` is installed

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 # This file is protected via CODEOWNERS
3 
4 import codecs
5 import os
6 import re
7 
8 from setuptools import setup
9 
10 base_path = os.path.dirname(__file__)
11 
12 # Get the version (borrowed from SQLAlchemy)
13 with open(os.path.join(base_path, "src", "urllib3", "_version.py")) as fp:
14     VERSION = (
15         re.compile(r""".*__version__ = ["'](.*?)['"]""", re.S).match(fp.read()).group(1)
16     )
17 
18 
19 with codecs.open("README.rst", encoding="utf-8") as fp:
20     # Remove reST raw directive from README as they're not allowed on PyPI
21     # Those blocks start with a newline and continue until the next newline
22     mode = None
23     lines = []
24     for line in fp:
25         if line.startswith(".. raw::"):
26             mode = "ignore_nl"
27         elif line == "\n":
28             mode = "wait_nl" if mode == "ignore_nl" else None
29 
30         if mode is None:
31             lines.append(line)
32     readme = "".join(lines)
33 
34 with codecs.open("CHANGES.rst", encoding="utf-8") as fp:
35     changes = fp.read()
36 
37 version = VERSION
38 
39 setup(
40     name="urllib3",
41     version=version,
42     description="HTTP library with thread-safe connection pooling, file post, and more.",
43     long_description=u"\n\n".join([readme, changes]),
44     long_description_content_type="text/x-rst",
45     classifiers=[
46         "Environment :: Web Environment",
47         "Intended Audience :: Developers",
48         "License :: OSI Approved :: MIT License",
49         "Operating System :: OS Independent",
50         "Programming Language :: Python",
51         "Programming Language :: Python :: 2",
52         "Programming Language :: Python :: 2.7",
53         "Programming Language :: Python :: 3",
54         "Programming Language :: Python :: 3.6",
55         "Programming Language :: Python :: 3.7",
56         "Programming Language :: Python :: 3.8",
57         "Programming Language :: Python :: 3.9",
58         "Programming Language :: Python :: 3.10",
59         "Programming Language :: Python :: 3.11",
60         "Programming Language :: Python :: Implementation :: CPython",
61         "Programming Language :: Python :: Implementation :: PyPy",
62         "Topic :: Internet :: WWW/HTTP",
63         "Topic :: Software Development :: Libraries",
64     ],
65     keywords="urllib httplib threadsafe filepost http https ssl pooling",
66     author="Andrey Petrov",
67     author_email="andrey.petrov@shazow.net",
68     url="https://urllib3.readthedocs.io/",
69     project_urls={
70         "Documentation": "https://urllib3.readthedocs.io/",
71         "Code": "https://github.com/urllib3/urllib3",
72         "Issue tracker": "https://github.com/urllib3/urllib3/issues",
73     },
74     license="MIT",
75     packages=[
76         "urllib3",
77         "urllib3.packages",
78         "urllib3.packages.backports",
79         "urllib3.contrib",
80         "urllib3.contrib._securetransport",
81         "urllib3.util",
82     ],
83     package_dir={"": "src"},
84     requires=[],
85     python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
86     extras_require={
87         "brotli": [
88             "brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'",
89             "brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython'",
90             "brotlipy>=0.6.0; os_name == 'nt' and python_version < '3'",
91         ],
92         "secure": [
93             "pyOpenSSL>=0.14",
94             "cryptography>=1.3.4",
95             "idna>=2.0.0",
96             "certifi",
97             "ipaddress; python_version=='2.7'",
98             "urllib3-secure-extra",
99         ],
100         "socks": ["PySocks>=1.5.6,<2.0,!=1.5.7"],
101     },
102 )
103
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -82,7 +82,7 @@
     ],
     package_dir={"": "src"},
     requires=[],
-    python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4",
+    python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
     extras_require={
         "brotli": [
             "brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'",

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -82,7 +82,7 @@\n     ],\n     package_dir={\"\": \"src\"},\n     requires=[],\n-    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4\",\n+    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*\",\n     extras_require={\n         \"brotli\": [\n             \"brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'\",\n", "issue": "`python_requires` prevents install of recent urllib3 when using Poetry\n### Subject\r\n\r\nre: https://github.com/urllib3/urllib3/pull/1309#issuecomment-356650894\r\n\r\nI no longer see the suggestion of including `<4` in the link referenced earlier in that PR (content relocated to https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires). Its inclusion is causing `1.22` to be installed.\r\n\r\nI use `poetry` to manage dependencies for https://github.com/cj81499/advent-of-code, and today I got a dependabot alert for urllib3 (CVE-2018-20060).\r\n\r\nI tried a `poetry update`, but poetry did not update urllib. `poetry add urllib3@latest` revealed the problem.\r\n\r\n```command\r\n> poetry add urllib3@latest\r\nUsing version ^1.26.12 for urllib3\r\n\r\nUpdating dependencies\r\nResolving dependencies... (0.0s)\r\n\r\nThe current project's Python requirement (>=3.9) is not compatible with some of the required packages Python requirement:\r\n  - urllib3 requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4, so it will not be satisfied for Python >=4\r\n\r\nBecause urllib3 (1.26.12) requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4\r\n and no versions of urllib3 match >1.26.12,<2.0.0, urllib3 is forbidden.\r\nSo, because aoc-cj depends on urllib3 (^1.26.12), version solving failed.\r\n\r\n  \u2022 Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties\r\n    \r\n    For urllib3, a possible solution would be to set the `python` property to \">=3.9,<4\"\r\n\r\n    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,\r\n    https://python-poetry.org/docs/dependency-specification/#using-environment-markers\r\n```\r\n\r\nAs a result of this change, I've been quietly stuck on `urllib3 v1.22` without even realizing it.\r\n\r\nAs suggested by poetry, I've changed _my_ python requirement from \">=3.9\" to \">=3.9,<4\" to be able to update, but I'm not sure there's a good reason to restrict the supported python versions to `<4`. Like I mentioned earlier, it seems this is no longer recommended by the Python docs.\r\n\r\nIn addition, since it didn't set a `python_requires`, a (future) Python 4 user might try to install urllib3 and get `v1.22`(!), which seems like pretty undesirable behavior to me.\r\n\r\n_Originally posted by @cj81499 in https://github.com/urllib3/urllib3/issues/1309#issuecomment-1301625738_\r\n\r\n### Environment\r\n\r\npoetry 1.2.2\r\n\r\nOS macOS-12.6-x86_64-i386-64bit\r\nPython 3.9.15\r\nurllib3 1.22\r\n\r\n### Steps to Reproduce\r\n\r\n- Install poetry\r\n- Clone https://github.com/cj81499/advent-of-code\r\n- Checkout commit `a8fecd3`\r\n- run `poetry install`\r\n- run `poetry show urllib3`\r\n- Observe that version 1.22 is installed\r\n\r\n### Expected Behavior\r\n\r\nLatest urllib3 (`1.26.12` at time of writing) is installed\r\n\r\n### Actual Behavior\r\n\r\nurllib3 `1.22` is installed\n", "before_files": [{"content": "#!/usr/bin/env python\n# This file is protected via CODEOWNERS\n\nimport codecs\nimport os\nimport re\n\nfrom setuptools import setup\n\nbase_path = os.path.dirname(__file__)\n\n# Get the version (borrowed from SQLAlchemy)\nwith open(os.path.join(base_path, \"src\", \"urllib3\", \"_version.py\")) as fp:\n    VERSION = (\n        re.compile(r\"\"\".*__version__ = [\"'](.*?)['\"]\"\"\", re.S).match(fp.read()).group(1)\n    )\n\n\nwith codecs.open(\"README.rst\", encoding=\"utf-8\") as fp:\n    # Remove reST raw directive from README as they're not allowed on PyPI\n    # Those blocks start with a newline and continue until the next newline\n    mode = None\n    lines = []\n    for line in fp:\n        if line.startswith(\".. raw::\"):\n            mode = \"ignore_nl\"\n        elif line == \"\\n\":\n            mode = \"wait_nl\" if mode == \"ignore_nl\" else None\n\n        if mode is None:\n            lines.append(line)\n    readme = \"\".join(lines)\n\nwith codecs.open(\"CHANGES.rst\", encoding=\"utf-8\") as fp:\n    changes = fp.read()\n\nversion = VERSION\n\nsetup(\n    name=\"urllib3\",\n    version=version,\n    description=\"HTTP library with thread-safe connection pooling, file post, and more.\",\n    long_description=u\"\\n\\n\".join([readme, changes]),\n    long_description_content_type=\"text/x-rst\",\n    classifiers=[\n        \"Environment :: Web Environment\",\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Programming Language :: Python :: Implementation :: PyPy\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Topic :: Software Development :: Libraries\",\n    ],\n    keywords=\"urllib httplib threadsafe filepost http https ssl pooling\",\n    author=\"Andrey Petrov\",\n    author_email=\"andrey.petrov@shazow.net\",\n    url=\"https://urllib3.readthedocs.io/\",\n    project_urls={\n        \"Documentation\": \"https://urllib3.readthedocs.io/\",\n        \"Code\": \"https://github.com/urllib3/urllib3\",\n        \"Issue tracker\": \"https://github.com/urllib3/urllib3/issues\",\n    },\n    license=\"MIT\",\n    packages=[\n        \"urllib3\",\n        \"urllib3.packages\",\n        \"urllib3.packages.backports\",\n        \"urllib3.contrib\",\n        \"urllib3.contrib._securetransport\",\n        \"urllib3.util\",\n    ],\n    package_dir={\"\": \"src\"},\n    requires=[],\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4\",\n    extras_require={\n        \"brotli\": [\n            \"brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'\",\n            \"brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython'\",\n            \"brotlipy>=0.6.0; os_name == 'nt' and python_version < '3'\",\n        ],\n        \"secure\": [\n            \"pyOpenSSL>=0.14\",\n            \"cryptography>=1.3.4\",\n            \"idna>=2.0.0\",\n            \"certifi\",\n            \"ipaddress; python_version=='2.7'\",\n            \"urllib3-secure-extra\",\n        ],\n        \"socks\": [\"PySocks>=1.5.6,<2.0,!=1.5.7\"],\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# This file is protected via CODEOWNERS\n\nimport codecs\nimport os\nimport re\n\nfrom setuptools import setup\n\nbase_path = os.path.dirname(__file__)\n\n# Get the version (borrowed from SQLAlchemy)\nwith open(os.path.join(base_path, \"src\", \"urllib3\", \"_version.py\")) as fp:\n    VERSION = (\n        re.compile(r\"\"\".*__version__ = [\"'](.*?)['\"]\"\"\", re.S).match(fp.read()).group(1)\n    )\n\n\nwith codecs.open(\"README.rst\", encoding=\"utf-8\") as fp:\n    # Remove reST raw directive from README as they're not allowed on PyPI\n    # Those blocks start with a newline and continue until the next newline\n    mode = None\n    lines = []\n    for line in fp:\n        if line.startswith(\".. raw::\"):\n            mode = \"ignore_nl\"\n        elif line == \"\\n\":\n            mode = \"wait_nl\" if mode == \"ignore_nl\" else None\n\n        if mode is None:\n            lines.append(line)\n    readme = \"\".join(lines)\n\nwith codecs.open(\"CHANGES.rst\", encoding=\"utf-8\") as fp:\n    changes = fp.read()\n\nversion = VERSION\n\nsetup(\n    name=\"urllib3\",\n    version=version,\n    description=\"HTTP library with thread-safe connection pooling, file post, and more.\",\n    long_description=u\"\\n\\n\".join([readme, changes]),\n    long_description_content_type=\"text/x-rst\",\n    classifiers=[\n        \"Environment :: Web Environment\",\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Programming Language :: Python :: Implementation :: PyPy\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Topic :: Software Development :: Libraries\",\n    ],\n    keywords=\"urllib httplib threadsafe filepost http https ssl pooling\",\n    author=\"Andrey Petrov\",\n    author_email=\"andrey.petrov@shazow.net\",\n    url=\"https://urllib3.readthedocs.io/\",\n    project_urls={\n        \"Documentation\": \"https://urllib3.readthedocs.io/\",\n        \"Code\": \"https://github.com/urllib3/urllib3\",\n        \"Issue tracker\": \"https://github.com/urllib3/urllib3/issues\",\n    },\n    license=\"MIT\",\n    packages=[\n        \"urllib3\",\n        \"urllib3.packages\",\n        \"urllib3.packages.backports\",\n        \"urllib3.contrib\",\n        \"urllib3.contrib._securetransport\",\n        \"urllib3.util\",\n    ],\n    package_dir={\"\": \"src\"},\n    requires=[],\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*\",\n    extras_require={\n        \"brotli\": [\n            \"brotli>=1.0.9; (os_name != 'nt' or python_version >= '3') and platform_python_implementation == 'CPython'\",\n            \"brotlicffi>=0.8.0; (os_name != 'nt' or python_version >= '3') and platform_python_implementation != 'CPython'\",\n            \"brotlipy>=0.6.0; os_name == 'nt' and python_version < '3'\",\n        ],\n        \"secure\": [\n            \"pyOpenSSL>=0.14\",\n            \"cryptography>=1.3.4\",\n            \"idna>=2.0.0\",\n            \"certifi\",\n            \"ipaddress; python_version=='2.7'\",\n            \"urllib3-secure-extra\",\n        ],\n        \"socks\": [\"PySocks>=1.5.6,<2.0,!=1.5.7\"],\n    },\n)\n", "path": "setup.py"}]}