diff --git "a/cleaned_prs.jsonl" "b/cleaned_prs.jsonl"
new file mode 100644--- /dev/null
+++ "b/cleaned_prs.jsonl"
@@ -0,0 +1,104004 @@
+{
+ "_id": "7fd7a89707530ea4",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.362973+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 7191,
+ "title": "Update maintainers in the AUTHORS.rst",
+ "body": "Updated the maintainers list with our rotations in the last year. This will align with the published metadata in #7012 once it's merged.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2026-01-30T22:52:33+00:00",
+ "merged_at": "2026-01-31T02:12:41+00:00",
+ "base_branch": "main",
+ "head_branch": "update-maintainers",
+ "additions": 7,
+ "deletions": 7,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 7,
+ "changes": 14,
+ "patch": "@@ -1,17 +1,17 @@\n Requests was lovingly created by [NAME_REDACTED]\n \n-Keepers of the Crystals\n-```````````````````````\n+Requests Maintainers\n+````````````````````\n \n+- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n - [NAME_REDACTED] [CONTRIBUTOR_REDACTED]\n-- [NAME_REDACTED] [CONTRIBUTOR_REDACTED]\n \n-Previous Keepers of Crystals\n-````````````````````````````\n+Previous Maintainers\n+````````````````````\n+\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED], reluctant Keeper of the Master Crystal.\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n-- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n-\n+- [NAME_REDACTED] [CONTRIBUTOR_REDACTED]\n \n Patches and Suggestions\n ```````````````````````"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3731002085,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2026-01-30T23:47:34+00:00"
+ },
+ {
+ "id": 3731009362,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T23:49:04+00:00"
+ },
+ {
+ "id": 3731208005,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-31T00:52:44+00:00"
+ },
+ {
+ "id": 3731209056,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-31T00:53:25+00:00"
+ },
+ {
+ "id": 3731210868,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-31T00:55:11+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2748444433,
+ "user": "user_0fa58b6f3572",
+ "body": "```suggestion\n- [NAME_EMAIL_REDACTED] [CONTRIBUTOR_REDACTED]\n```",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T23:47:28+00:00"
+ },
+ {
+ "id": 2748449786,
+ "user": "user_dbf2a999bd6d",
+ "body": "I completely missed that 😅 Apologies.",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T23:49:04+00:00"
+ },
+ {
+ "id": 2748609530,
+ "user": "user_0fa58b6f3572",
+ "body": "Maybe we should rename \"Keepers of the Crystals\" too at some point",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-31T00:53:25+00:00"
+ },
+ {
+ "id": 2748611665,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yep, I'm onboard with that. We can just swap it to maintainers and former.",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-31T00:55:11+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "1060d9a975ea74ca",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 7012,
+ "title": "Migrate build system to PEP 517",
+ "body": "This PR follows up on the original [announcement ](https://github.com/psf/requests/releases/tag/v2.32.0) of migrating Requests to a PEP 517 compliant backend in 2.33.0. This PR proposes moving to ~~hatchling which has wide adoption, but there's an argument for staying on setuptools~~ setuptools after reviewing our current needs. I'd be curious to hear from other maintainers on if there's a strong preference in either direction based on other projects.\n\n[USER_REDACTED] or [USER_REDACTED] may have input from migrating urllib3 as well. Presumably users with urllib3 2.x are already capable of building with this setup in their environment.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2025-08-17T16:29:40+00:00",
+ "merged_at": "2026-01-31T02:25:56+00:00",
+ "base_branch": "main",
+ "head_branch": "hatchling",
+ "additions": 79,
+ "deletions": 111,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "pyproject.toml",
+ "status": "modified",
+ "additions": 75,
+ "deletions": 1,
+ "changes": 76,
+ "patch": "@@ -1,3 +1,76 @@\n+[build-system]\n+requires = [\"setuptools>=61.0\"]\n+build-backend = \"setuptools.build_meta\"\n+\n+[project]\n+name = \"requests\"\n+description = \"Python HTTP for Humans.\"\n+readme = \"README.md\"\n+license = {text = \"Apache-2.0\"}\n+authors = [\n+ { name = \"[NAME_REDACTED]\", email = \"[EMAIL_REDACTED]\" },\n+]\n+maintainers = [\n+ {name = \"[NAME_REDACTED]\", email=\"[EMAIL_REDACTED]\"},\n+ {name = \"[NAME_REDACTED]\", email=\"[EMAIL_REDACTED]\"}\n+]\n+requires-python = \">=3.9\"\n+dependencies = [\n+ \"charset_normalizer>=2,<4\",\n+ \"idna>=2.5,<4\",\n+ \"urllib3>=1.21.1,<3\",\n+ \"certifi>=2017.4.17\"\n+]\n+dynamic = [\"version\"]\n+\n+classifiers = [\n+ \"[NAME_REDACTED] :: 5 - Production/Stable\",\n+ \"Environment :: [NAME_REDACTED]\",\n+ \"[NAME_REDACTED] :: Developers\",\n+ \"License :: OSI Approved :: [NAME_REDACTED]\",\n+ \"[NAME_REDACTED] :: English\",\n+ \"[NAME_REDACTED] :: OS Independent\",\n+ \"[NAME_REDACTED] :: Python\",\n+ \"[NAME_REDACTED] :: Python :: 3\",\n+ \"[NAME_REDACTED] :: Python :: 3.9\",\n+ \"[NAME_REDACTED] :: Python :: 3.10\",\n+ \"[NAME_REDACTED] :: Python :: 3.11\",\n+ \"[NAME_REDACTED] :: Python :: 3.12\",\n+ \"[NAME_REDACTED] :: Python :: 3.13\",\n+ \"[NAME_REDACTED] :: Python :: 3.14\",\n+ \"[NAME_REDACTED] :: Python :: 3 :: Only\",\n+ \"[NAME_REDACTED] :: Python :: Implementation :: CPython\",\n+ \"[NAME_REDACTED] :: Python :: Implementation :: PyPy\",\n+ \"Topic :: Internet :: WWW/HTTP\",\n+ \"Topic :: [NAME_REDACTED] :: Libraries\"\n+]\n+\n+[project.urls]\n+Documentation = \"https://requests.readthedocs.io\"\n+Source = \"https://github.com/psf/requests\"\n+\n+[project.optional-dependencies]\n+security = []\n+socks = [\"PySocks>=1.5.6, !=1.5.7\"]\n+use_chardet_on_py3 = [\"chardet>=3.0.2,<6\"]\n+test = [\n+ \"pytest-httpbin==2.1.0\",\n+ \"pytest-cov\",\n+ \"pytest-mock\",\n+ \"pytest-xdist\",\n+ \"PySocks>=1.5.6, !=1.5.7\",\n+ \"pytest>=3\"\n+]\n+\n+[tool.setuptools]\n+license-files = [\"LICENSE\", \"NOTICE\"]\n+\n+[tool.setuptools.dynamic]\n+version = {attr = \"requests.__version__.__version__\"}\n+\n+[tool.setuptools.packages.find]\n+where = [\"src\"]\n+\n [tool.ruff]\n target-version = \"py310\"\n src = [\"src/requests\", \"tests\"]\n@@ -12,7 +85,8 @@ select = [\n \"UP\", # pyupgrade\n \"T10\", # flake8-debugger (replaces debug-statements hook)\n ]\n-ignore = [\"E203\", \"E501\", \"UP038\", \"UP031\"]\n+# UP036: Remove once Python 3.10 is the minimum supported version\n+ignore = [\"E203\", \"E501\", \"UP038\", \"UP031\", \"UP036\"]\n per-file-ignores = {\"src/requests/__init__.py\" = [\"E402\", \"F401\"], \"src/requests/compat.py\" = [\"E402\", \"F401\"], \"tests/compat.py\" = [\"F401\"]}\n \n [tool.ruff.lint.isort]"
+ },
+ {
+ "filename": "setup.cfg",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 10,
+ "changes": 10,
+ "patch": "@@ -1,10 +0,0 @@\n-[metadata]\n-license_file = LICENSE\n-provides-extra =\n- socks\n- use_chardet_on_py3\n-requires-dist =\n- certifi>=2017.4.17\n- charset_normalizer>=2,<4\n- idna>=2.5,<4\n- urllib3>=1.21.1,<3"
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 100,
+ "changes": 104,
+ "patch": "@@ -1,105 +1,9 @@\n-#!/usr/bin/env python\n-import os\n import sys\n-from codecs import open\n \n-from setuptools import setup\n-\n-CURRENT_PYTHON = sys.version_info[:2]\n-REQUIRED_PYTHON = (3, 9)\n-\n-if CURRENT_PYTHON < REQUIRED_PYTHON:\n- sys.stderr.write(\n- \"\"\"\n-==========================\n-[NAME_REDACTED] version\n-==========================\n-This version of Requests requires at least Python {}.{}, but\n-you're trying to install it on Python {}.{}. To resolve this,\n-consider upgrading to a supported Python version.\n-\n-If you can't upgrade your Python version, you'll need to\n-pin to an older version of Requests (<2.32.0).\n-\"\"\".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))\n- )\n+if sys.version_info < (3, 9):\n+ sys.stderr.write(\"Requests requires Python 3.9 or later.\\n\")\n sys.exit(1)\n \n+from setuptools import setup\n \n-# 'setup.py publish' shortcut.\n-if sys.argv[-1] == \"publish\":\n- os.system(\"python setup.py sdist bdist_wheel\")\n- os.system(\"twine upload dist/*\")\n- sys.exit()\n-\n-requires = [\n- \"charset_normalizer>=2,<4\",\n- \"idna>=2.5,<4\",\n- \"urllib3>=1.21.1,<3\",\n- \"certifi>=2017.4.17\",\n-]\n-test_requirements = [\n- \"pytest-httpbin==2.1.0\",\n- \"pytest-cov\",\n- \"pytest-mock\",\n- \"pytest-xdist\",\n- \"PySocks>=1.5.6, !=1.5.7\",\n- \"pytest>=3\",\n-]\n-\n-about = {}\n-here = os.path.abspath(os.path.dirname(__file__))\n-with open(os.path.join(here, \"src\", \"requests\", \"__version__.py\"), \"r\", \"utf-8\") as f:\n- exec(f.read(), about)\n-\n-with open(\"README.md\", \"r\", \"utf-8\") as f:\n- readme = f.read()\n-\n-setup(\n- name=about[\"__title__\"],\n- version=about[\"__version__\"],\n- description=about[\"__description__\"],\n- long_description=readme,\n- long_description_content_type=\"text/markdown\",\n- author=about[\"__author__\"],\n- author_email=about[\"__author_email__\"],\n- url=about[\"__url__\"],\n- packages=[\"requests\"],\n- package_data={\"\": [\"LICENSE\", \"NOTICE\"]},\n- package_dir={\"\": \"src\"},\n- include_package_data=True,\n- python_requires=\">=3.9\",\n- install_requires=requires,\n- license=about[\"__license__\"],\n- zip_safe=False,\n- classifiers=[\n- \"[NAME_REDACTED] :: 5 - Production/Stable\",\n- \"Environment :: [NAME_REDACTED]\",\n- \"[NAME_REDACTED] :: Developers\",\n- \"License :: OSI Approved :: [NAME_REDACTED]\",\n- \"[NAME_REDACTED] :: English\",\n- \"[NAME_REDACTED] :: OS Independent\",\n- \"[NAME_REDACTED] :: Python\",\n- \"[NAME_REDACTED] :: Python :: 3\",\n- \"[NAME_REDACTED] :: Python :: 3.9\",\n- \"[NAME_REDACTED] :: Python :: 3.10\",\n- \"[NAME_REDACTED] :: Python :: 3.11\",\n- \"[NAME_REDACTED] :: Python :: 3.12\",\n- \"[NAME_REDACTED] :: Python :: 3.13\",\n- \"[NAME_REDACTED] :: Python :: 3.14\",\n- \"[NAME_REDACTED] :: Python :: 3 :: Only\",\n- \"[NAME_REDACTED] :: Python :: Implementation :: CPython\",\n- \"[NAME_REDACTED] :: Python :: Implementation :: PyPy\",\n- \"Topic :: Internet :: WWW/HTTP\",\n- \"Topic :: [NAME_REDACTED] :: Libraries\",\n- ],\n- tests_require=test_requirements,\n- extras_require={\n- \"security\": [],\n- \"socks\": [\"PySocks>=1.5.6, !=1.5.7\"],\n- \"use_chardet_on_py3\": [\"chardet>=3.0.2,<6\"],\n- },\n- project_urls={\n- \"Documentation\": \"https://requests.readthedocs.io\",\n- \"Source\": \"https://github.com/psf/requests\",\n- },\n-)\n+setup()"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3730413647,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:08:43+00:00"
+ },
+ {
+ "id": 3730866462,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T23:08:15+00:00"
+ },
+ {
+ "id": 3731211174,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-31T00:55:33+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2748329758,
+ "user": "user_dbf2a999bd6d",
+ "body": "I'll note here that we left the text identifier instead of using [PEP 639](https://peps.python.org/pep-0639/) intentionally. While it is marked for deprecation in Feb 2027, the minimum supported version (setuptools 77) is still quite recent and I'm not comfortable bringing the floor up that high yet. We'll evaluate how this initial migration goes and address that later.",
+ "path": "pyproject.toml",
+ "line": 9,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T23:08:16+00:00"
+ },
+ {
+ "id": 2748611996,
+ "user": "user_0fa58b6f3572",
+ "body": "It wouldn't be a day ending in y if something in [NAME_REDACTED] wasn't being deprecated with hard to find warning messages, that's for sure. ;)",
+ "path": "pyproject.toml",
+ "line": 9,
+ "side": "RIGHT",
+ "created_at": "2026-01-31T00:55:33+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "cfg",
+ "py",
+ "toml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "04a3ac8f90ef3153",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6963,
+ "title": "fix CVE 2024 47081: manual url parsing leads to netloc credentials leak",
+ "body": "https://seclists.org/fulldisclosure/2025/Jun/2\n\nHonestly I have no idea why this lib used `netloc` + manual parsing instead of `hostname` as I can see references to `hostname` as early as from [the python 2.6 docs](https://docs.python.org/2.6/library/urlparse.html).",
+ "author": "user_50fe2a4bfbbf",
+ "created_at": "2025-06-04T10:59:08+00:00",
+ "merged_at": "2025-06-05T14:55:33+00:00",
+ "base_branch": "main",
+ "head_branch": "aw/fix-CVE-2024-47081",
+ "additions": 20,
+ "deletions": 8,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "src/requests/utils.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 8,
+ "changes": 9,
+ "patch": "@@ -219,14 +219,7 @@ def get_netrc_auth(url, raise_errors=False):\n netrc_path = None\n \n for f in netrc_locations:\n- try:\n- loc = os.path.expanduser(f)\n- except KeyError:\n- # os.path.expanduser can fail when $HOME is undefined and\n- # getpwuid fails. See https://bugs.python.org/issue20164 &\n- # https://github.com/psf/requests/issues/1846\n- return\n-\n+ loc = os.path.expanduser(f)\n if os.path.exists(loc):\n netrc_path = loc\n break"
+ },
+ {
+ "filename": "tests/test_utils.py",
+ "status": "modified",
+ "additions": 19,
+ "deletions": 0,
+ "changes": 19,
+ "patch": "@@ -23,6 +23,7 @@\n get_encoding_from_headers,\n get_encodings_from_content,\n get_environ_proxies,\n+ get_netrc_auth,\n guess_filename,\n guess_json_utf,\n is_ipv4_address,\n@@ -152,6 +153,24 @@ def test_super_len_with_no_matches(self):\n assert super_len(object()) == 0\n \n \n+class TestGetNetrcAuth:\n+ def test_works(self, tmp_path, monkeypatch):\n+ netrc_path = tmp_path / \".netrc\"\n+ monkeypatch.setenv(\"NETRC\", str(netrc_path))\n+ with open(netrc_path, \"w\") as f:\n+ f.write(\"machine example.com login aaaa password bbbb\\n\")\n+ auth = get_netrc_auth(\"http://example.com/thing\")\n+ assert auth == (\"aaaa\", \"bbbb\")\n+\n+ def test_not_vulnerable_to_bad_url_parsing(self, tmp_path, monkeypatch):\n+ netrc_path = tmp_path / \".netrc\"\n+ monkeypatch.setenv(\"NETRC\", str(netrc_path))\n+ with open(netrc_path, \"w\") as f:\n+ f.write(\"machine example.com login aaaa password bbbb\\n\")\n+ auth = get_netrc_auth(\"http://example.com:[USER_REDACTED].com/'\")\n+ assert auth is None\n+\n+\n class TestToKeyValList:\n [USER_REDACTED].mark.parametrize(\n \"value, expected\","
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2899123279,
+ "user": "user_b94daa584f46",
+ "state": "COMMENTED",
+ "body": "About the test, I created another test for the same issue in a [different PR](https://github.com/psf/requests/pull/6962/). So at this point, the issue is fixed and it could be nice to have a test for this case, I'm okay to close my PR if this test is good enough, or keep it if maintainers are okay to have two tests for this case.",
+ "submitted_at": "2025-06-05T07:17:48+00:00"
+ },
+ {
+ "id": 2900241034,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-06-05T13:00:47+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2128118428,
+ "user": "user_b94daa584f46",
+ "body": "This is fixed now in main: https://github.com/psf/requests/commit/96ba401c1296ab1dda74a2365ef36d88f7d144ef",
+ "path": "src/requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-06-05T07:12:17+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "0c69e1dbe0a5b84e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6951,
+ "title": "docs: fix dead links to kenreitz.org",
+ "body": "I noticed a few dead links. Looking back through the [wayback machine](https://web.archive.org/web/20220203091232/https://kenreitz.org/essays/2012/06/14/the-future-of-python-http), I was able to find the new location of these articles.",
+ "author": "user_4759e575a3d3",
+ "created_at": "2025-05-21T16:11:00+00:00",
+ "merged_at": "2025-06-01T18:07:18+00:00",
+ "base_branch": "main",
+ "head_branch": "patch-1",
+ "additions": 13,
+ "deletions": 18,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "docs/conf.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -58,7 +58,7 @@\n \n # General information about the project.\n project = u\"Requests\"\n-copyright = u'MMXVIX. A [NAME_REDACTED] Project'\n+copyright = u'MMXVIX. A [NAME_REDACTED]'\n author = u\"[NAME_REDACTED]\"\n \n # The version info for the project you're documenting, acts as replacement for"
+ },
+ {
+ "filename": "docs/dev/contributing.rst",
+ "status": "modified",
+ "additions": 9,
+ "deletions": 11,
+ "changes": 20,
+ "patch": "@@ -22,19 +22,17 @@ The guide is split into sections based on the type of contribution you're\n thinking of making, with a section that covers general guidelines for all\n contributors.\n \n-[NAME_REDACTED]\n-----------\n+Code of Conduct\n+---------------\n \n- **Be cordial or be on your way**. *—[NAME_REDACTED]*\n+The Python community is made up of members from around the globe with a diverse\n+set of skills, personalities, and experiences. It is through these differences\n+that our community experiences great successes and continued growth. When you're\n+working with members of the community, follow the\n+`[NAME_REDACTED] Code of Conduct`_ to help steer your interactions\n+and keep Python a positive, successful, and growing community.\n \n-Requests has one very important rule governing all forms of contribution,\n-including reporting bugs or requesting features. This golden rule is\n-\"`be cordial or be on your way`_\".\n-\n-**All contributions are welcome**, as long as\n-everyone involved is treated with respect.\n-\n-.. _be cordial or be on your way: https://kenreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way\n+.. _Python [NAME_REDACTED] of Conduct: https://policies.python.org/python.org/code-of-conduct/\n \n .. _early-feedback:"
+ },
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 6,
+ "changes": 9,
+ "patch": "@@ -969,11 +969,9 @@ Requests will automatically parse these link headers and make them easily consum\n [NAME_REDACTED]\n ------------------\n \n-As of v1.0.0, Requests has moved to a modular internal design. Part of the\n-reason this was done was to implement [NAME_REDACTED], originally\n-`described here`_. [NAME_REDACTED] provide a mechanism to define interaction\n-methods for an HTTP service. In particular, they allow you to apply per-service\n-configuration.\n+As of v1.0.0, Requests has moved to a modular internal design using Transport\n+Adapters. These objects provide a mechanism to define interaction methods for an\n+HTTP service. In particular, they allow you to apply per-service configuration.\n \n Requests ships with a single [NAME_REDACTED], the :class:`HTTPAdapter\n `. This adapter provides the default Requests\n@@ -1053,7 +1051,6 @@ backoff, within a Requests :class:`Session ` using the\n )\n s.mount('https://', HTTPAdapter(max_retries=retries))\n \n-.. _`described here`: https://kenreitz.org/essays/2012/06/14/the-future-of-python-http\n .. _`urllib3`: https://github.com/urllib3/urllib3\n .. _`urllib3.util.Retry`: https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2858933976,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": "At this point I'd prefer we just remove these links. We get PRs every few years whenever the domain changes.",
+ "submitted_at": "2025-05-30T20:21:09+00:00"
+ },
+ {
+ "id": 2885730837,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-06-01T14:53:49+00:00"
+ },
+ {
+ "id": 2885894125,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-06-01T18:06:54+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2101041830,
+ "user": "user_dbf2a999bd6d",
+ "body": "```suggestion\ncopyright = u'MMXVIX. A [NAME_REDACTED]'\n```",
+ "path": "docs/conf.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-05-21T19:45:04+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "03198075bb0d5124",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6876,
+ "title": "Add netrc file search information to authentication documentation",
+ "body": "Added paragraph (copied from `quickstart.rst`) with information where Requests search for `.netrc` file.\n\nIt should make it easier to find this information when somebody reads regular documentation (as opposite to quickstart documentation).",
+ "author": "user_bce9f40bbd56",
+ "created_at": "2025-01-27T20:57:34+00:00",
+ "merged_at": "2025-06-08T17:47:56+00:00",
+ "base_branch": "main",
+ "head_branch": "main",
+ "additions": 11,
+ "deletions": 0,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/user/authentication.rst",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 0,
+ "changes": 10,
+ "patch": "@@ -44,6 +44,16 @@ set with `headers=`.\n If credentials for the hostname are found, the request is sent with HTTP [NAME_REDACTED].\n \n+Requests will search for the netrc file at `~/.netrc`, `~/_netrc`, or at the path\n+specified by the `NETRC` environment variable. `~` denotes the user's home\n+directory, which is `$HOME` on Unix based systems and `%USERPROFILE%` on Windows.\n+\n+Usage of netrc file can be disabled by setting `trust_env` to `False` in the\n+Requests session::\n+\n+ >>> s = requests.Session()\n+ >>> s.trust_env = False\n+ >>> s.get('https://httpbin.org/basic-auth/user/pass')\n \n [NAME_REDACTED]\n ---------------------"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -222,6 +222,7 @@ Note: Custom headers are given less precedence than more specific sources of inf\n are specified in ``.netrc``, which in turn will be overridden by the ``auth=``\n parameter. Requests will search for the netrc file at `~/.netrc`, `~/_netrc`,\n or at the path specified by the `NETRC` environment variable.\n+ Check details in :ref:`netrc authentication `.\n * Authorization headers will be removed if you get redirected off-host.\n * Proxy-Authorization headers will be overridden by [NAME_REDACTED] the URL.\n * Content-Length headers will be overridden when we can determine the length of the content."
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2576791060,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2025-01-27T23:56:26+00:00"
+ },
+ {
+ "id": 2579164936,
+ "user": "user_bce9f40bbd56",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-01-28T18:56:49+00:00"
+ },
+ {
+ "id": 2588345952,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-02-01T14:24:13+00:00"
+ },
+ {
+ "id": 2588413785,
+ "user": "user_bce9f40bbd56",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-02-01T21:39:19+00:00"
+ },
+ {
+ "id": 2908591702,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-06-08T17:47:49+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1931340274,
+ "user": "user_0fa58b6f3572",
+ "body": "This doesn't list the Windows paths or how to disable this altogether.",
+ "path": "docs/user/authentication.rst",
+ "line": 47,
+ "side": "RIGHT",
+ "created_at": "2025-01-27T23:56:20+00:00"
+ },
+ {
+ "id": 1932704347,
+ "user": "user_bce9f40bbd56",
+ "body": "[USER_REDACTED] please check updated commit.",
+ "path": "docs/user/authentication.rst",
+ "line": 47,
+ "side": "RIGHT",
+ "created_at": "2025-01-28T18:56:49+00:00"
+ },
+ {
+ "id": 1938283997,
+ "user": "user_0fa58b6f3572",
+ "body": "This is not at all what I meant.\n\n`trust_env=False` is the Requests mechanism for overriding this behaviour.\n\nThis may also work, but telling folks to use `/dev/null` I believe causes pathological behaviour on some versions of Python today.",
+ "path": "docs/user/authentication.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-02-01T14:24:12+00:00"
+ },
+ {
+ "id": 1938350825,
+ "user": "user_bce9f40bbd56",
+ "body": "I'm coming from Linux world where `/dev/null` is very respected thing 😄 \n\nI pushed new commit - I hope it looks better now.",
+ "path": "docs/user/authentication.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-02-01T21:39:18+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "c9a211c62ed85a9f",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6802,
+ "title": "start testing on 3.13rc",
+ "body": null,
+ "author": "user_43e0ee7d352e",
+ "created_at": "2024-09-18T14:05:21+00:00",
+ "merged_at": "2024-09-19T11:19:03+00:00",
+ "base_branch": "main",
+ "head_branch": "3.13",
+ "additions": 6,
+ "deletions": 4,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": ".github/workflows/run-tests.yml",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -12,7 +12,7 @@ jobs:\n strategy:\n fail-fast: false\n matrix:\n- python-version: [\"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\", \"pypy-3.9\", \"pypy-3.10\"]\n+ python-version: [\"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\", \"3.13\", \"pypy-3.9\", \"pypy-3.10\"]\n os: [ubuntu-22.04, macOS-latest, windows-latest]\n # Python 3.8 and 3.9 do not run on macOS-latest which\n # is now using arm64 hardware.\n@@ -31,6 +31,7 @@ jobs:\n with:\n python-version: ${{ matrix.python-version }}\n cache: 'pip'\n+ allow-prereleases: true\n - name: Install dependencies\n run: |\n make"
+ },
+ {
+ "filename": "requirements-dev.txt",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,7 +1,7 @@\n -e .[socks]\n pytest>=2.8.0,<9\n pytest-cov\n-pytest-httpbin==2.0.0\n+pytest-httpbin==2.1.0\n httpbin~=0.10.0\n trustme\n wheel"
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -40,7 +40,7 @@\n \"certifi>=2017.4.17\",\n ]\n test_requirements = [\n- \"pytest-httpbin==2.0.0\",\n+ \"pytest-httpbin==2.1.0\",\n \"pytest-cov\",\n \"pytest-mock\",\n \"pytest-xdist\",\n@@ -87,6 +87,7 @@\n \"[NAME_REDACTED] :: Python :: 3.10\",\n \"[NAME_REDACTED] :: Python :: 3.11\",\n \"[NAME_REDACTED] :: Python :: 3.12\",\n+ \"[NAME_REDACTED] :: Python :: 3.13\",\n \"[NAME_REDACTED] :: Python :: 3 :: Only\",\n \"[NAME_REDACTED] :: Python :: Implementation :: CPython\",\n \"[NAME_REDACTED] :: Python :: Implementation :: PyPy\","
+ },
+ {
+ "filename": "tox.ini",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,5 +1,5 @@\n [tox]\n-envlist = py{38,39,310,311,312}-{default, use_chardet_on_py3}\n+envlist = py{38,39,310,311,312,313}-{default, use_chardet_on_py3}\n \n [testenv]\n deps = -rrequirements-dev.txt"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2313094592,
+ "user": "user_43e0ee7d352e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-09-18T15:36:17+00:00"
+ },
+ {
+ "id": 2313094844,
+ "user": "user_43e0ee7d352e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-09-18T15:36:24+00:00"
+ },
+ {
+ "id": 2313379055,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-09-18T17:50:26+00:00"
+ },
+ {
+ "id": 2313421466,
+ "user": "user_43e0ee7d352e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-09-18T18:11:52+00:00"
+ },
+ {
+ "id": 2313481566,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "I think we're also missing an update for the [`tox`](https://github.com/psf/requests/blob/f12ccbef6d6b95564da8d22e280d28c39d53f0e9/tox.ini#L2) file.",
+ "submitted_at": "2024-09-18T18:35:34+00:00"
+ },
+ {
+ "id": 2313495230,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-09-18T18:41:09+00:00"
+ },
+ {
+ "id": 2315230566,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-09-19T11:18:58+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1765295100,
+ "user": "user_43e0ee7d352e",
+ "body": "```suggestion\npytest-httpbin==2.1.0\n```",
+ "path": "requirements-dev.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-09-18T15:36:17+00:00"
+ },
+ {
+ "id": 1765295244,
+ "user": "user_43e0ee7d352e",
+ "body": "```suggestion\n \"pytest-httpbin==2.1.0\",\n```",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-09-18T15:36:24+00:00"
+ },
+ {
+ "id": 1765474720,
+ "user": "user_dbf2a999bd6d",
+ "body": "Do we still need this or can it be removed now that `pytest-httpbin` is fully released?",
+ "path": ".github/workflows/run-tests.yml",
+ "line": 34,
+ "side": "RIGHT",
+ "created_at": "2024-09-18T17:50:26+00:00"
+ },
+ {
+ "id": 1765499793,
+ "user": "user_43e0ee7d352e",
+ "body": "This is needed for 3.13rc. it doesn't effect pip installs",
+ "path": ".github/workflows/run-tests.yml",
+ "line": 34,
+ "side": "RIGHT",
+ "created_at": "2024-09-18T18:11:52+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "ini",
+ "py",
+ "txt",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 4,
+ "CHANGES_REQUESTED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "02ef1a7c4086687a",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6767,
+ "title": "Revert caching a default SSLContext",
+ "body": "This PR reverts the changes from #6667 to the previous behavior. Due to the number of edge cases and concurrency issues we've encountered with this change, we've decided the benefit doesn't currently outweigh the pain to existing infrastructure. We've iterated on a few tries to keep this functionality in place, but are still receiving reports of novel issues with this behavior.\n\nWe may be able to revisit this in a later version of Requests but we'll need a much more comprehensive test plan.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2024-07-18T18:00:33+00:00",
+ "merged_at": "2025-06-13T16:42:08+00:00",
+ "base_branch": "main",
+ "head_branch": "remove_cached_sslcontext",
+ "additions": 16,
+ "deletions": 39,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 16,
+ "deletions": 39,
+ "changes": 55,
+ "patch": "@@ -27,7 +27,6 @@\n from urllib3.util import Timeout as TimeoutSauce\n from urllib3.util import parse_url\n from urllib3.util.retry import Retry\n-from urllib3.util.ssl_ import create_urllib3_context\n \n from .auth import _basic_auth_str\n from .compat import basestring, urlparse\n@@ -74,19 +73,6 @@ def SOCKSProxyManager(*args, **kwargs):\n DEFAULT_POOL_TIMEOUT = None\n \n \n-try:\n- import ssl # noqa: F401\n-\n- _preloaded_ssl_context = create_urllib3_context()\n- _preloaded_ssl_context.load_verify_locations(\n- extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n- )\n-except ImportError:\n- # Bypass default SSLContext creation when Python\n- # interpreter isn't built with the ssl module.\n- _preloaded_ssl_context = None\n-\n-\n def _urllib3_request_context(\n request: \"PreparedRequest\",\n verify: \"bool | str | None\",\n@@ -99,19 +85,9 @@ def _urllib3_request_context(\n scheme = parsed_request_url.scheme.lower()\n port = parsed_request_url.port\n \n- # Determine if we have and should use our default SSLContext\n- # to optimize performance on standard requests.\n- poolmanager_kwargs = getattr(poolmanager, \"connection_pool_kw\", {})\n- has_poolmanager_ssl_context = poolmanager_kwargs.get(\"ssl_context\")\n- should_use_default_ssl_context = (\n- _preloaded_ssl_context is not None and not has_poolmanager_ssl_context\n- )\n-\n cert_reqs = \"CERT_REQUIRED\"\n if verify is False:\n cert_reqs = \"CERT_NONE\"\n- elif verify is True and should_use_default_ssl_context:\n- pool_kwargs[\"ssl_context\"] = _preloaded_ssl_context\n elif isinstance(verify, str):\n if not os.path.isdir(verify):\n pool_kwargs[\"ca_certs\"] = verify\n@@ -314,26 +290,27 @@ def cert_verify(self, conn, url, verify, cert):\n :param cert: The SSL certificate to verify.\n \"\"\"\n if url.lower().startswith(\"https\") and verify:\n- conn.cert_reqs = \"CERT_REQUIRED\"\n+ cert_loc = None\n \n- # Only load the CA certificates if 'verify' is a string indicating the CA bundle to use.\n- # Otherwise, if verify is a boolean, we don't load anything since\n- # the connection will be using a context with the default certificates already loaded,\n- # and this avoids a call to the slow load_verify_locations()\n+ # Allow self-specified cert location.\n if verify is not True:\n- # `verify` must be a str with a path then\n cert_loc = verify\n \n- if not os.path.exists(cert_loc):\n- raise OSError(\n- f\"Could not find a suitable TLS CA certificate bundle, \"\n- f\"invalid path: {cert_loc}\"\n- )\n+ if not cert_loc:\n+ cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n \n- if not os.path.isdir(cert_loc):\n- conn.ca_certs = cert_loc\n- else:\n- conn.ca_cert_dir = cert_loc\n+ if not cert_loc or not os.path.exists(cert_loc):\n+ raise OSError(\n+ f\"Could not find a suitable TLS CA certificate bundle, \"\n+ f\"invalid path: {cert_loc}\"\n+ )\n+\n+ conn.cert_reqs = \"CERT_REQUIRED\"\n+\n+ if not os.path.isdir(cert_loc):\n+ conn.ca_certs = cert_loc\n+ else:\n+ conn.ca_cert_dir = cert_loc\n else:\n conn.cert_reqs = \"CERT_NONE\"\n conn.ca_certs = None"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2186534311,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-07-18T18:02:54+00:00"
+ },
+ {
+ "id": 2887963612,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-06-02T11:30:11+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1683276287,
+ "user": "user_dbf2a999bd6d",
+ "body": "This is one piece I left in place from #6667. We were unilaterally considering any `verify` string to be `ca_certs` instead of detecting if it was a directory. That seems like a miss from #6655 unless I'm missing something?",
+ "path": "src/requests/adapters.py",
+ "line": 92,
+ "side": "RIGHT",
+ "created_at": "2024-07-18T18:02:54+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "d3dbe5decf31f69c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6757,
+ "title": "Test on urllib3 1.26.x",
+ "body": "First step to address #6734. We'll enable testing on urllib3 1.26.x which was lost when we moved the pin to support 2.x. These will fail for now until the underlying issue is addressed, but this is to ensure we're catching any future breakages.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2024-07-02T01:11:04+00:00",
+ "merged_at": "2024-07-30T01:44:14+00:00",
+ "base_branch": "main",
+ "head_branch": "urllib-1.x-tests",
+ "additions": 60,
+ "deletions": 18,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": ".github/workflows/run-tests.yml",
+ "status": "modified",
+ "additions": 20,
+ "deletions": 0,
+ "changes": 20,
+ "patch": "@@ -57,3 +57,23 @@ jobs:\n - name: Run tests\n run: |\n make ci\n+\n+ urllib3:\n+ name: 'urllib3 1.x'\n+ runs-on: 'ubuntu-latest'\n+ strategy:\n+ fail-fast: true\n+\n+ steps:\n+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608\n+ - name: 'Set up Python 3.8'\n+ uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d\n+ with:\n+ python-version: '3.8'\n+ - name: Install dependencies\n+ run: |\n+ make\n+ python -m pip install \"urllib3<2\"\n+ - name: Run tests\n+ run: |\n+ make ci"
+ },
+ {
+ "filename": "src/requests/compat.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 0,
+ "changes": 12,
+ "patch": "@@ -10,6 +10,18 @@\n import importlib\n import sys\n \n+# -------\n+# urllib3\n+# -------\n+from urllib3 import __version__ as urllib3_version\n+\n+# Detect which major version of urllib3 is being used.\n+try:\n+ is_urllib3_1 = int(urllib3_version.split(\".\")[0]) == 1\n+except (TypeError, AttributeError):\n+ # If we can't discern a version, prefer old functionality.\n+ is_urllib3_1 = True\n+\n # -------------------\n # [NAME_REDACTED]\n # -------------------"
+ },
+ {
+ "filename": "src/requests/utils.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 1,
+ "changes": 5,
+ "patch": "@@ -38,6 +38,7 @@\n getproxies,\n getproxies_environment,\n integer_types,\n+ is_urllib3_1,\n )\n from .compat import parse_http_list as _parse_list_header\n from .compat import (\n@@ -136,7 +137,9 @@ def super_len(o):\n total_length = None\n current_position = 0\n \n- if isinstance(o, str):\n+ if not is_urllib3_1 and isinstance(o, str):\n+ # urllib3 2.x+ treats all strings as utf-8 instead\n+ # of latin-1 (iso-8859-1) like http.client.\n o = o.encode(\"utf-8\")\n \n if hasattr(o, \"__len__\"):"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 24,
+ "deletions": 17,
+ "changes": 41,
+ "patch": "@@ -25,6 +25,7 @@\n builtin_str,\n cookielib,\n getproxies,\n+ is_urllib3_1,\n urlparse,\n )\n from requests.cookies import cookiejar_from_dict, morsel_to_cookie\n@@ -1810,23 +1811,6 @@ def test_autoset_header_values_are_native(self, httpbin):\n \n assert p.headers[\"Content-Length\"] == length\n \n- def test_content_length_for_bytes_data(self, httpbin):\n- data = \"This is a string containing multi-byte UTF-8 ☃️\"\n- encoded_data = data.encode(\"utf-8\")\n- length = str(len(encoded_data))\n- req = requests.Request(\"POST\", httpbin(\"post\"), data=encoded_data)\n- p = req.prepare()\n-\n- assert p.headers[\"Content-Length\"] == length\n-\n- def test_content_length_for_string_data_counts_bytes(self, httpbin):\n- data = \"This is a string containing multi-byte UTF-8 ☃️\"\n- length = str(len(data.encode(\"utf-8\")))\n- req = requests.Request(\"POST\", httpbin(\"post\"), data=data)\n- p = req.prepare()\n-\n- assert p.headers[\"Content-Length\"] == length\n-\n def test_nonhttp_schemes_dont_check_URLs(self):\n test_urls = (\n \"data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==\",\n@@ -2966,6 +2950,29 @@ def response_handler(sock):\n assert client_cert is not None\n \n \n+def test_content_length_for_bytes_data(httpbin):\n+ data = \"This is a string containing multi-byte UTF-8 ☃️\"\n+ encoded_data = data.encode(\"utf-8\")\n+ length = str(len(encoded_data))\n+ req = requests.Request(\"POST\", httpbin(\"post\"), data=encoded_data)\n+ p = req.prepare()\n+\n+ assert p.headers[\"Content-Length\"] == length\n+\n+\n+[USER_REDACTED].mark.skipif(\n+ is_urllib3_1,\n+ reason=\"urllib3 2.x encodes all strings to utf-8, urllib3 1.x uses latin-1\",\n+)\n+def test_content_length_for_string_data_counts_bytes(httpbin):\n+ data = \"This is a string containing multi-byte UTF-8 ☃️\"\n+ length = str(len(data.encode(\"utf-8\")))\n+ req = requests.Request(\"POST\", httpbin(\"post\"), data=data)\n+ p = req.prepare()\n+\n+ assert p.headers[\"Content-Length\"] == length\n+\n+\n def test_json_decode_errors_are_serializable_deserializable():\n json_decode_error = requests.exceptions.JSONDecodeError(\n \"Extra data\","
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2152480764,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "LGTM! Thanks for testing urllib3 :)",
+ "submitted_at": "2024-07-02T01:16:19+00:00"
+ },
+ {
+ "id": 2153790038,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-07-02T13:20:47+00:00"
+ },
+ {
+ "id": 2186404336,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-07-18T16:49:44+00:00"
+ },
+ {
+ "id": 2186420534,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-07-18T16:58:58+00:00"
+ },
+ {
+ "id": 2205199013,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-07-29T14:49:41+00:00"
+ },
+ {
+ "id": 2206392532,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-07-30T01:16:53+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1683193453,
+ "user": "user_b08fb5f52ea1",
+ "body": "I believe this is a string, not an integer. Also, should do a >= check instead of equals.",
+ "path": "src/requests/compat.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-07-18T16:49:44+00:00"
+ },
+ {
+ "id": 1683204168,
+ "user": "user_dbf2a999bd6d",
+ "body": "Good catch on the `int`. For the equivalence, I don't know if `>=` is what we want if this is specifically scoping the 2.x major version. In the same way I wouldn't want an `is_py3` to include Python 4.x. We could do something like `is_gt_urllib3_1` but that seems like it may be premature forwards-compatibility?\n\nRight now our dependencies are scoped at `urllib3<3` and if we add this check to any other behaviors, I'd rather they stay scoped to the major version. That will let tests fail if we major version again and we can make an informed decision at that point when adding support. Otherwise, we may unintentionally carry forward behaviors that are subtly wrong.\n\nI can see similar risks with both sides, so not a hill I'm going to die on, but that was my initial thought process.",
+ "path": "src/requests/compat.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-07-18T16:58:58+00:00"
+ },
+ {
+ "id": 1695374605,
+ "user": "user_dbf2a999bd6d",
+ "body": "I've changed the check from checking for urllib3 2.x to check for 1.x. That leaves us open to forward compatibility without the confusing behavior with `is_urllib3_2` including newer major versions.",
+ "path": "src/requests/compat.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-07-29T14:49:41+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "yml"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 3,
+ "COMMENTED": 3
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "c209700120bc5bb8",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6724,
+ "title": "Don't create default SSLContext if ssl module isn't present",
+ "body": "This PR is to address a [recent regression in Emscripten support for urllib3](https://github.com/urllib3/urllib3/actions/runs/9253144050/job/25452248794). We began unilaterally creating an SSLContext without consideration for Python versions built without an ssl module. This is handled in urllib3 but missed in our usage of `create_urllib3_context`.\n\nThis PR expands on the fix in #6716 by [NAME_REDACTED] presence of the `ssl` module before creating and setting the default SSLContext.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2024-05-28T19:34:27+00:00",
+ "merged_at": "2024-05-29T15:23:40+00:00",
+ "base_branch": "main",
+ "head_branch": "ssl_optimization",
+ "additions": 19,
+ "deletions": 5,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 19,
+ "deletions": 5,
+ "changes": 24,
+ "patch": "@@ -73,10 +73,18 @@ def SOCKSProxyManager(*args, **kwargs):\n DEFAULT_RETRIES = 0\n DEFAULT_POOL_TIMEOUT = None\n \n-_preloaded_ssl_context = create_urllib3_context()\n-_preloaded_ssl_context.load_verify_locations(\n- extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n-)\n+\n+try:\n+ import ssl # noqa: F401\n+\n+ _preloaded_ssl_context = create_urllib3_context()\n+ _preloaded_ssl_context.load_verify_locations(\n+ extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n+ )\n+except ImportError:\n+ # Bypass default SSLContext creation when Python\n+ # interpreter isn't built with the ssl module.\n+ _preloaded_ssl_context = None\n \n \n def _urllib3_request_context(\n@@ -90,13 +98,19 @@ def _urllib3_request_context(\n parsed_request_url = urlparse(request.url)\n scheme = parsed_request_url.scheme.lower()\n port = parsed_request_url.port\n+\n+ # Determine if we have and should use our default SSLContext\n+ # to optimize performance on standard requests.\n poolmanager_kwargs = getattr(poolmanager, \"connection_pool_kw\", {})\n has_poolmanager_ssl_context = poolmanager_kwargs.get(\"ssl_context\")\n+ should_use_default_ssl_context = (\n+ _preloaded_ssl_context is not None and not has_poolmanager_ssl_context\n+ )\n \n cert_reqs = \"CERT_REQUIRED\"\n if verify is False:\n cert_reqs = \"CERT_NONE\"\n- elif verify is True and not has_poolmanager_ssl_context:\n+ elif verify is True and should_use_default_ssl_context:\n pool_kwargs[\"ssl_context\"] = _preloaded_ssl_context\n elif isinstance(verify, str):\n if not os.path.isdir(verify):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2083791089,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-28T21:17:07+00:00"
+ },
+ {
+ "id": 2083948577,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-28T22:28:51+00:00"
+ },
+ {
+ "id": 2084021685,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-28T23:58:30+00:00"
+ },
+ {
+ "id": 2084021778,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-05-28T23:58:37+00:00"
+ },
+ {
+ "id": 2084022830,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-29T00:00:07+00:00"
+ },
+ {
+ "id": 2085603226,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-05-29T14:32:43+00:00"
+ },
+ {
+ "id": 2085739900,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-29T15:23:20+00:00"
+ },
+ {
+ "id": 2411765982,
+ "user": "user_adf270769e63",
+ "state": "COMMENTED",
+ "body": "Rerun have timestamp",
+ "submitted_at": "2024-11-03T01:40:09+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1617854876,
+ "user": "user_0fa58b6f3572",
+ "body": "Missed this earlier but do we need any logic for verify=True without a condition here?",
+ "path": "src/requests/adapters.py",
+ "line": 113,
+ "side": "RIGHT",
+ "created_at": "2024-05-28T20:27:08+00:00"
+ },
+ {
+ "id": 1617955993,
+ "user": "user_dbf2a999bd6d",
+ "body": "Are you asking about the behavior if `verify is True` but `should_use_default_ssl_context` is False? This was a no-op prior to #6655 which fellback to letting the SSLContext be created when fetching the connection from the pool. [`_ssl_wrap_socket_and_match_hostname`](https://github.com/urllib3/urllib3/blob/b07a669bd970d69847801148286b726f0570b625/src/urllib3/connection.py#L755-L765) handles this for us, so I don't know if there's any additional concern from our previous behavior unless I'm missing part of the question.",
+ "path": "src/requests/adapters.py",
+ "line": 113,
+ "side": "RIGHT",
+ "created_at": "2024-05-28T22:28:51+00:00"
+ },
+ {
+ "id": 1618008653,
+ "user": "user_0fa58b6f3572",
+ "body": "Makes sense. I've a terrible headache so just looking at the branches and concerned about missing something is all.",
+ "path": "src/requests/adapters.py",
+ "line": 113,
+ "side": "RIGHT",
+ "created_at": "2024-05-28T23:58:29+00:00"
+ },
+ {
+ "id": 1618009506,
+ "user": "user_dbf2a999bd6d",
+ "body": "Nope, that's a good call out. I'll give it one more look before merging but I think we're ok for that case.",
+ "path": "src/requests/adapters.py",
+ "line": 113,
+ "side": "RIGHT",
+ "created_at": "2024-05-29T00:00:07+00:00"
+ },
+ {
+ "id": 1619000165,
+ "user": "user_0fa58b6f3572",
+ "body": "Oh, looking again, not on a phone, and without a migraine, I see the `cert_reqs = \"CERT_REQUIRED\"` line on L110 that I clearly wrote, and which is what I was thinking we may want to be concerned about. So, I'm not nearly as worried.",
+ "path": "src/requests/adapters.py",
+ "line": 113,
+ "side": "RIGHT",
+ "created_at": "2024-05-29T14:31:10+00:00"
+ },
+ {
+ "id": 1619003075,
+ "user": "user_0fa58b6f3572",
+ "body": "Looking at this again with something of a performance mindset, do we want to cache somehow lookups to `isdir`? I'm not sure this hurts us at all, but just thinking about things that could slow us down in certain cases now. (Not for this pull request, just putting it out there)",
+ "path": "src/requests/adapters.py",
+ "line": 116,
+ "side": "RIGHT",
+ "created_at": "2024-05-29T14:32:37+00:00"
+ },
+ {
+ "id": 1619084935,
+ "user": "user_dbf2a999bd6d",
+ "body": "That seems like a reasonable optimization, I guess we'd need to check how much time we're actually spending on the dir check. I assume we'll get feedback if we have cases where this is a bottleneck.",
+ "path": "src/requests/adapters.py",
+ "line": 116,
+ "side": "RIGHT",
+ "created_at": "2024-05-29T15:23:20+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 6,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 7,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 7
+ }
+}
+{
+ "_id": "c603a7094897e516",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6716,
+ "title": "Allow for overriding of specific pool key params",
+ "body": "This re-enables the use case of providing a custom SSLContext via a [NAME_REDACTED] as broken in #6655 and reported in #6715\n\nCloses #6715",
+ "author": "user_0fa58b6f3572",
+ "created_at": "2024-05-22T11:53:49+00:00",
+ "merged_at": "2024-05-24T21:37:06+00:00",
+ "base_branch": "main",
+ "head_branch": "bug/6715",
+ "additions": 81,
+ "deletions": 10,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 0,
+ "changes": 7,
+ "patch": "@@ -6,6 +6,13 @@ dev\n \n - \\[Short description of non-trivial change.\\]\n \n+2.32.3 (2024-05-24)\n+-------------------\n+\n+**Bugfixes**\n+- Fix bug breaking the ability to specify custom SSLContexts in sub-classes of\n+ HTTPAdapter. (#6716)\n+\n 2.32.2 (2024-05-21)\n -------------------"
+ },
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 74,
+ "deletions": 10,
+ "changes": 84,
+ "patch": "@@ -83,16 +83,20 @@ def _urllib3_request_context(\n request: \"PreparedRequest\",\n verify: \"bool | str | None\",\n client_cert: \"typing.Tuple[str, str] | str | None\",\n+ poolmanager: \"PoolManager\",\n ) -> \"(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])\":\n host_params = {}\n pool_kwargs = {}\n parsed_request_url = urlparse(request.url)\n scheme = parsed_request_url.scheme.lower()\n port = parsed_request_url.port\n+ poolmanager_kwargs = getattr(poolmanager, \"connection_pool_kw\", {})\n+ has_poolmanager_ssl_context = poolmanager_kwargs.get(\"ssl_context\")\n+\n cert_reqs = \"CERT_REQUIRED\"\n if verify is False:\n cert_reqs = \"CERT_NONE\"\n- elif verify is True:\n+ elif verify is True and not has_poolmanager_ssl_context:\n pool_kwargs[\"ssl_context\"] = _preloaded_ssl_context\n elif isinstance(verify, str):\n if not os.path.isdir(verify):\n@@ -375,23 +379,83 @@ def build_response(self, req, resp):\n \n return response\n \n+ def build_connection_pool_key_attributes(self, request, verify, cert=None):\n+ \"\"\"Build the PoolKey attributes used by urllib3 to return a connection.\n+\n+ This looks at the PreparedRequest, the user-specified verify value,\n+ and the value of the cert parameter to determine what PoolKey values\n+ to use to select a connection from a given urllib3 [NAME_REDACTED].\n+\n+ The SSL related pool key arguments are not consistently set. As of\n+ this writing, use the following to determine what keys may be in that\n+ dictionary:\n+\n+ * If ``verify`` is ``True``, ``\"ssl_context\"`` will be set and will be the\n+ default Requests SSL Context\n+ * If ``verify`` is ``False``, ``\"ssl_context\"`` will not be set but\n+ ``\"cert_reqs\"`` will be set\n+ * If ``verify`` is a string, (i.e., it is a user-specified trust bundle)\n+ ``\"ca_certs\"`` will be set if the string is not a directory recognized\n+ by :py:func:`os.path.isdir`, otherwise ``\"ca_certs_dir\"`` will be\n+ set.\n+ * If ``\"cert\"`` is specified, ``\"cert_file\"`` will always be set. If\n+ ``\"cert\"`` is a tuple with a second item, ``\"key_file\"`` will also\n+ be present\n+\n+ To override these settings, one may subclass this class, call this\n+ method and use the above logic to change parameters as desired. For\n+ example, if one wishes to use a custom :py:class:`ssl.SSLContext` one\n+ must both set ``\"ssl_context\"`` and based on what else they require,\n+ alter the other keys to ensure the desired behaviour.\n+\n+ :param request:\n+ The PreparedReqest being sent over the connection.\n+ :type request:\n+ :class:`~requests.models.PreparedRequest`\n+ :param verify:\n+ Either a boolean, in which case it controls whether\n+ we verify the server's TLS certificate, or a string, in which case it\n+ must be a path to a CA bundle to use.\n+ :param cert:\n+ (optional) Any user-provided SSL certificate for client\n+ authentication (a.k.a., mTLS). This may be a string (i.e., just\n+ the path to a file which holds both certificate and key) or a\n+ tuple of length 2 with the certificate file path and key file\n+ path.\n+ :returns:\n+ A tuple of two dictionaries. The first is the \"host parameters\"\n+ portion of the [NAME_REDACTED] including scheme, hostname, and port. The\n+ second is a dictionary of SSLContext related parameters.\n+ \"\"\"\n+ return _urllib3_request_context(request, verify, cert, self.poolmanager)\n+\n def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):\n \"\"\"Returns a urllib3 connection for the given request and TLS settings.\n This should not be called from user code, and is only exposed for use\n when subclassing the :class:`HTTPAdapter `.\n \n- :param request: The :class:`PreparedRequest ` object\n- to be sent over the connection.\n- :param verify: Either a boolean, in which case it controls whether\n- we verify the server's TLS certificate, or a string, in which case it\n- must be a path to a CA bundle to use.\n- :param proxies: (optional) The proxies dictionary to apply to the request.\n- :param cert: (optional) Any user-provided SSL certificate to be trusted.\n- :rtype: urllib3.ConnectionPool\n+ :param request:\n+ The :class:`PreparedRequest ` object to be sent\n+ over the connection.\n+ :param verify:\n+ Either a boolean, in which case it controls whether we verify the\n+ server's TLS certificate, or a string, in which case it must be a\n+ path to a CA bundle to use.\n+ :param proxies:\n+ (optional) The proxies dictionary to apply to the request.\n+ :param cert:\n+ (optional) Any user-provided SSL certificate to be used for client\n+ authentication (a.k.a., mTLS).\n+ :rtype:\n+ urllib3.ConnectionPool\n \"\"\"\n proxy = select_proxy(request.url, proxies)\n try:\n- host_params, pool_kwargs = _urllib3_request_context(request, verify, cert)\n+ host_params, pool_kwargs = self.build_connection_pool_key_attributes(\n+ request,\n+ verify,\n+ cert,\n+ )\n except ValueError as e:\n raise InvalidURL(e, request=request)\n if proxy:"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2071195950,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": "If [USER_REDACTED], [USER_REDACTED] and/or [USER_REDACTED] are willing to give this patch a try, it would be nice to make sure we're not missing any other requirements.\n\nOtherwise this seems straight forward to me, just a couple minor comments to add a date and the current PR reference.",
+ "submitted_at": "2024-05-22T13:28:44+00:00"
+ },
+ {
+ "id": 2072332359,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "I think this looks good to go. We've received some early indication is solves this class of problems from what's been raised. I'll plan to cut a release with this tomorrow AM in the US.",
+ "submitted_at": "2024-05-22T20:46:01+00:00"
+ },
+ {
+ "id": 2342569167,
+ "user": "user_e6d1de3927d6",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-10-02T10:28:12+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1609951561,
+ "user": "user_dbf2a999bd6d",
+ "body": "```suggestion\n2.32.3 (2024-05-23)\n```",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-05-22T13:25:02+00:00"
+ },
+ {
+ "id": 1609952141,
+ "user": "user_dbf2a999bd6d",
+ "body": "```suggestion\n HTTPAdapter. (#6716)\n```",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-05-22T13:25:22+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "e2b38a834355bced",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6710,
+ "title": "Move _get_connection to get_connection_with_tls_context",
+ "body": "This PR is meant to provide a new publicly supported api `get_connection_with_tls_context` to better facilitate custom adapters with our recent fix for CVE-2024-35195.\n\nAs described [here](https://github.com/psf/requests/issues/6707#issuecomment-2122490651), we will be deprecating the existing `get_connection` API, and custom adapters will need to migrate their existing `get_connection` implementations to use `get_connection_with_tls_context`. Below is a very simple implementation that will get projects relying on a custom `get_connection` implementation unblocked.\n\nHowever, we _strongly_ recommend maintainers evaluate if their custom `get_connection` is subject to the same issues as the CVE above and make appropriate changes as needed.\n\n**Minimum new code to work as a pass-through**\nThis will be backwards compatible between versions of Requests.\n```python\ndef get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):\n return self.get_connection(request.url, proxies)\n```",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2024-05-21T15:58:50+00:00",
+ "merged_at": "2024-05-21T16:41:18+00:00",
+ "base_branch": "main",
+ "head_branch": "api_rename",
+ "additions": 31,
+ "deletions": 6,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 31,
+ "deletions": 6,
+ "changes": 37,
+ "patch": "@@ -9,6 +9,7 @@\n import os.path\n import socket # noqa: F401\n import typing\n+import warnings\n \n from urllib3.exceptions import ClosedPoolError, ConnectTimeoutError\n from urllib3.exceptions import HTTPError as _HTTPError\n@@ -374,10 +375,20 @@ def build_response(self, req, resp):\n \n return response\n \n- def _get_connection(self, request, verify, proxies=None, cert=None):\n- # Replace the existing get_connection without breaking things and\n- # ensure that TLS settings are considered when we interact with\n- # urllib3 HTTP Pools\n+ def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):\n+ \"\"\"Returns a urllib3 connection for the given request and TLS settings.\n+ This should not be called from user code, and is only exposed for use\n+ when subclassing the :class:`HTTPAdapter `.\n+\n+ :param request: The :class:`PreparedRequest ` object\n+ to be sent over the connection.\n+ :param verify: Either a boolean, in which case it controls whether\n+ we verify the server's TLS certificate, or a string, in which case it\n+ must be a path to a CA bundle to use.\n+ :param proxies: (optional) The proxies dictionary to apply to the request.\n+ :param cert: (optional) Any user-provided SSL certificate to be trusted.\n+ :rtype: urllib3.ConnectionPool\n+ \"\"\"\n proxy = select_proxy(request.url, proxies)\n try:\n host_params, pool_kwargs = _urllib3_request_context(request, verify, cert)\n@@ -404,14 +415,26 @@ def _get_connection(self, request, verify, proxies=None, cert=None):\n return conn\n \n def get_connection(self, url, proxies=None):\n- \"\"\"Returns a urllib3 connection for the given URL. This should not be\n+ \"\"\"DEPRECATED: Users should move to `get_connection_with_tls_context`\n+ for all subclasses of HTTPAdapter using Requests>=2.32.2.\n+\n+ Returns a urllib3 connection for the given URL. This should not be\n called from user code, and is only exposed for use when subclassing the\n :class:`HTTPAdapter `.\n \n :param url: The URL to connect to.\n :param proxies: (optional) A Requests-style dictionary of proxies used on this request.\n :rtype: urllib3.ConnectionPool\n \"\"\"\n+ warnings.warn(\n+ (\n+ \"`get_connection` has been deprecated in favor of \"\n+ \"`get_connection_with_tls_context`. Custom HTTPAdapter subclasses \"\n+ \"will need to migrate for Requests>=2.32.2. Please see \"\n+ \"https://github.com/psf/requests/pull/6710 for more details.\"\n+ ),\n+ DeprecationWarning,\n+ )\n proxy = select_proxy(url, proxies)\n \n if proxy:\n@@ -529,7 +552,9 @@ def send(\n \"\"\"\n \n try:\n- conn = self._get_connection(request, verify, proxies=proxies, cert=cert)\n+ conn = self.get_connection_with_tls_context(\n+ request, verify, proxies=proxies, cert=cert\n+ )\n except LocationValueError as e:\n raise InvalidURL(e, request=request)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2069075746,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "Looks good, only had one suggestion that might require a new test.",
+ "submitted_at": "2024-05-21T16:13:58+00:00"
+ },
+ {
+ "id": 2069085116,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-21T16:17:36+00:00"
+ },
+ {
+ "id": 2069109177,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-21T16:29:48+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1608603801,
+ "user": "user_b08fb5f52ea1",
+ "body": "If this method is deprecated shall we start emitting `DeprecationWarning`?",
+ "path": "src/requests/adapters.py",
+ "line": 418,
+ "side": "RIGHT",
+ "created_at": "2024-05-21T16:12:52+00:00"
+ },
+ {
+ "id": 1608609666,
+ "user": "user_dbf2a999bd6d",
+ "body": "I thought about that but it's not reachable in any of our code anymore and if someone is using a custom implementation it won't have the warning.\n\nHappy to be wrong if I'm missing something but it seems like it will just be dead code on arrival.",
+ "path": "src/requests/adapters.py",
+ "line": 418,
+ "side": "RIGHT",
+ "created_at": "2024-05-21T16:17:36+00:00"
+ },
+ {
+ "id": 1608624860,
+ "user": "user_dbf2a999bd6d",
+ "body": "I guess it's better to be safe, this should be addressed in 92075b330a30b9883f466a43d3f7566ab849f91b.",
+ "path": "src/requests/adapters.py",
+ "line": 418,
+ "side": "RIGHT",
+ "created_at": "2024-05-21T16:29:48+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "7505d25d2dba74e6",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6702,
+ "title": "Allow optional char detection dependencies in post-packaging",
+ "body": "This PR is a proposal to relax our requirement to have a character detection library present with all installations of Requests. While we cannot remove our reliance on `charset_normalizer` or `chardet`, there are use cases where Requests is repackaged in applications or other tools that do not need our character detection behavior. These changes will enable them to remove those dependencies from their installation.\n\nThe current use case for this shift is to allow `pip` to remove these dependencies entirely. That should slim the package ~2MB in 24.1.0 and avoid the overhead of importing the unneeded dependency.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2024-05-14T22:25:35+00:00",
+ "merged_at": "2024-05-15T00:15:19+00:00",
+ "base_branch": "main",
+ "head_branch": "no_char_detection",
+ "additions": 60,
+ "deletions": 23,
+ "changed_files": 5,
+ "files": [
+ {
+ "filename": ".github/workflows/run-tests.yml",
+ "status": "modified",
+ "additions": 20,
+ "deletions": 0,
+ "changes": 20,
+ "patch": "@@ -37,3 +37,23 @@ jobs:\n - name: Run tests\n run: |\n make ci\n+\n+ no_chardet:\n+ name: \"[NAME_REDACTED]\"\n+ runs-on: ubuntu-latest\n+ strategy:\n+ fail-fast: true\n+\n+ steps:\n+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608\n+ - name: 'Set up Python 3.8'\n+ uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d\n+ with:\n+ python-version: '3.8'\n+ - name: Install dependencies\n+ run: |\n+ make\n+ python -m pip uninstall -y \"charset_normalizer\" \"chardet\"\n+ - name: Run tests\n+ run: |\n+ make ci"
+ },
+ {
+ "filename": "src/requests/__init__.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 1,
+ "changes": 6,
+ "patch": "@@ -83,7 +83,11 @@ def check_compatibility(urllib3_version, chardet_version, charset_normalizer_ver\n # charset_normalizer >= 2.0.0 < 4.0.0\n assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0)\n else:\n- raise Exception(\"You need either charset_normalizer or chardet installed\")\n+ warnings.warn(\n+ \"Unable to find acceptable character detection dependency \"\n+ \"(chardet or charset_normalizer).\",\n+ RequestsDependencyWarning,\n+ )\n \n \n def _check_cryptography(cryptography_version):"
+ },
+ {
+ "filename": "src/requests/compat.py",
+ "status": "modified",
+ "additions": 20,
+ "deletions": 5,
+ "changes": 25,
+ "patch": "@@ -7,13 +7,28 @@\n compatibility until the next major version.\n \"\"\"\n \n-try:\n- import chardet\n-except ImportError:\n- import charset_normalizer as chardet\n-\n+import importlib\n import sys\n \n+# -------------------\n+# [NAME_REDACTED]\n+# -------------------\n+\n+\n+def _resolve_char_detection():\n+ \"\"\"Find supported character detection libraries.\"\"\"\n+ chardet = None\n+ for lib in (\"chardet\", \"charset_normalizer\"):\n+ if chardet is None:\n+ try:\n+ chardet = importlib.import_module(lib)\n+ except ImportError:\n+ pass\n+ return chardet\n+\n+\n+chardet = _resolve_char_detection()\n+\n # -------\n # Pythons\n # -------"
+ },
+ {
+ "filename": "src/requests/models.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -789,7 +789,12 @@ def next(self):\n [USER_REDACTED]\n def apparent_encoding(self):\n \"\"\"The apparent encoding, provided by [NAME_REDACTED]_normalizer or chardet libraries.\"\"\"\n- return chardet.detect(self.content)[\"encoding\"]\n+ if chardet is not None:\n+ return chardet.detect(self.content)[\"encoding\"]\n+ else:\n+ # If no character detection library is available, we'll fall back\n+ # to a standard Python utf-8 str.\n+ return \"utf-8\"\n \n def iter_content(self, chunk_size=1, decode_unicode=False):\n \"\"\"Iterates over the response data. When stream=True is set on the"
+ },
+ {
+ "filename": "src/requests/packages.py",
+ "status": "modified",
+ "additions": 9,
+ "deletions": 16,
+ "changes": 25,
+ "patch": "@@ -1,13 +1,6 @@\n import sys\n \n-try:\n- import chardet\n-except ImportError:\n- import warnings\n-\n- import charset_normalizer as chardet\n-\n- warnings.filterwarnings(\"ignore\", \"Trying to detect\", module=\"charset_normalizer\")\n+from .compat import chardet\n \n # This code exists for backwards compatibility reasons.\n # I don't like it either. Just look the other way. :)\n@@ -20,11 +13,11 @@\n if mod == package or mod.startswith(f\"{package}.\"):\n sys.modules[f\"requests.packages.{mod}\"] = sys.modules[mod]\n \n-target = chardet.__name__\n-for mod in list(sys.modules):\n- if mod == target or mod.startswith(f\"{target}.\"):\n- imported_mod = sys.modules[mod]\n- sys.modules[f\"requests.packages.{mod}\"] = imported_mod\n- mod = mod.replace(target, \"chardet\")\n- sys.modules[f\"requests.packages.{mod}\"] = imported_mod\n-# Kinda cool, though, right?\n+if chardet is not None:\n+ target = chardet.__name__\n+ for mod in list(sys.modules):\n+ if mod == target or mod.startswith(f\"{target}.\"):\n+ imported_mod = sys.modules[mod]\n+ sys.modules[f\"requests.packages.{mod}\"] = imported_mod\n+ mod = mod.replace(target, \"chardet\")\n+ sys.modules[f\"requests.packages.{mod}\"] = imported_mod"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 2056669581,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-05-15T00:15:13+00:00"
+ },
+ {
+ "id": 2070448164,
+ "user": "user_2f8f1a139e37",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-05-22T08:08:55+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1609492798,
+ "user": "user_2f8f1a139e37",
+ "body": "While this keeps the logic of the earlier code, I think that the library which is required on should be tried first. https://github.com/psf/requests/pull/6714 addresses this.",
+ "path": "src/requests/compat.py",
+ "line": 21,
+ "side": "RIGHT",
+ "created_at": "2024-05-22T08:08:55+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "2c32ef2bbaccc4eb",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6667,
+ "title": "Avoid reloading root certificates to improve concurrent performance",
+ "body": "## Reproducing the problem\n\nLet's consider the following script. It runs a bunch of concurrent requests against a URL, both with certificate verification enabled and disabled, and outputs the time it takes to do it in both cases.\n\n```py\nfrom time import time\nfrom threading import Thread\nimport requests\nimport urllib3\n\nurllib3.disable_warnings()\n\ndef do_request(verify):\n requests.get('https://example.com', verify=verify)\n\ndef measure(verify):\n threads = [Thread(target=do_request, args=(verify,)) for _ in range(30)]\n\n start = time()\n for t in threads: t.start()\n for t in threads: t.join()\n end = time()\n\n print(end - start)\n\nmeasure(verify=True)\nmeasure(verify=False)\n```\n\nWhat's the time difference between the two? It turns out it is highly dependent on your local configuration. On my local machine, with a relatively modern config (Python 3.12 + OpenSSL 3.0.2), the times are `~1.2s` for `verify=True` and `~0.5s` for `verify=False`.\n\nIt's a >100% difference, but we initially blamed it on cert verification taking some time. However, we observed even larger differences (>500%) in some environments, and decided to find out what was going on.\n\n## Problem description\n\nOur main use case for requests is running lots of requests concurrently, and we spent some time bisecting this oddity to see if there was room for a performance optimization.\n\nThe issue is a bit more clear if you profile the concurrent executions. When verifying certs, these are the top 3 function calls by [NAME_REDACTED]:\n\n```\nncalls tottime percall cumtime percall filename:lineno(function)\n30/1 0.681 0.023 0.002 0.002 {method 'load_verify_locations' of '_ssl._SSLContext' objects}\n30/1 0.181 0.006 0.002 0.002 {method 'connect' of '_socket.socket' objects}\n60/2 0.180 0.003 1.323 0.662 {method 'read' of '_ssl._SSLSocket' objects}\n```\n\nConversely, this is how the top 3 looks like without cert verification:\n\n```\nncalls tottime percall cumtime percall filename:lineno(function)\n30/1 0.233 0.008 0.001 0.001 {method 'do_handshake' of '_ssl._SSLSocket' objects}\n30/1 0.106 0.004 0.002 0.002 {method 'connect' of '_socket.socket' objects}\n60/2 0.063 0.001 0.505 0.253 {method 'read' of '_ssl._SSLSocket' objects}\n```\n\nIn the first case, a full 0.68 seconds are spent in the `load_verify_locations()` function of the `ssl` module, which configures a `SSLContext` object to use a set of CA certificates for validation. Inside it, there is a C FFI call to OpenSSL's `SSL_CTX_load_verify_locations()` which [is known](https://github.com/[USER_REDACTED]n/cpython/issues/95031) to be [quite slow](https://github.com/[USER_REDACTED]nssl/openssl/issues/16871). This happens once per request (hence the `30` on the left).\n\nWe believe that, in some cases, there is even some blocking going on, either because each FFI call locks up the GIL or because of some thread safety mechanisms in OpenSSL itself. We also think that this is more or less pronounced depending on internal changes between OpenSSL's versions, hence the variability between environments.\n\nWhen cert validation isn't needed, these calls are skipped which speeds up concurrent performance dramatically.\n\n## Submitted solution\n\nIt isn't possible to skip loading root CA certificates entirely, but it isn't necessary to do it on every request. More specifically, a call to `load_verify_locations()` happens when:\n\n- A new `urllib3.connectionpool.HTTPSConnectionPool` is created.\n\n- On connection, by urllib3's `ssl_wrap_socket()`, when the connection's `ca_certs` or `ca_cert_dir` attributes are set (see [the relevant code](https://github.com/urllib3/urllib3/blob/9929d3c4e03b71ba485148a8390cd9411981f40f/src/urllib3/util/ssl_.py#L438)).\n\nThe first case doesn't need to be addressed anymore after the latest addition of `_get_connection()`. Since it now passes down `pool_kwargs`, this allows urllib3 to use a cached pool with the same settings every time, instead of creating one per request.\n\nThe second one is addressed in this PR. If a verified connection is requested, `_urllib3_request_context()` already makes it so that a connection pool using a `SSLContext` with all relevant certificates loaded is always used. Hence, there is no need to trigger a call to `load_verify_locations()` again.\n\nYou can test against https://invalid.badssl.com to check that `verify=True` and `verify=False` still behave as expected and are now equally fast.\n\nI'd like to mention that there have been a few changes in Requests since I started drafting this, and I'm not sure that setting `conn.ca_certs` or `conn.ca_certs = cert_loc` in `cert_verify()` is even still needed, since I think that the logic could be moved to `_urllib3_request_context()` and benefit from using a cached context in those cases too.",
+ "author": "user_14f21d37ae53",
+ "created_at": "2024-03-20T11:51:17+00:00",
+ "merged_at": "2024-05-15T20:07:26+00:00",
+ "base_branch": "main",
+ "head_branch": "main",
+ "additions": 28,
+ "deletions": 18,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 28,
+ "deletions": 18,
+ "changes": 46,
+ "patch": "@@ -26,6 +26,7 @@\n from urllib3.util import Timeout as TimeoutSauce\n from urllib3.util import parse_url\n from urllib3.util.retry import Retry\n+from urllib3.util.ssl_ import create_urllib3_context\n \n from .auth import _basic_auth_str\n from .compat import basestring, urlparse\n@@ -71,6 +72,11 @@ def SOCKSProxyManager(*args, **kwargs):\n DEFAULT_RETRIES = 0\n DEFAULT_POOL_TIMEOUT = None\n \n+_preloaded_ssl_context = create_urllib3_context()\n+_preloaded_ssl_context.load_verify_locations(\n+ extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n+)\n+\n \n def _urllib3_request_context(\n request: \"PreparedRequest\",\n@@ -85,8 +91,13 @@ def _urllib3_request_context(\n cert_reqs = \"CERT_REQUIRED\"\n if verify is False:\n cert_reqs = \"CERT_NONE\"\n- if isinstance(verify, str):\n- pool_kwargs[\"ca_certs\"] = verify\n+ elif verify is True:\n+ pool_kwargs[\"ssl_context\"] = _preloaded_ssl_context\n+ elif isinstance(verify, str):\n+ if not os.path.isdir(verify):\n+ pool_kwargs[\"ca_certs\"] = verify\n+ else:\n+ pool_kwargs[\"ca_cert_dir\"] = verify\n pool_kwargs[\"cert_reqs\"] = cert_reqs\n if client_cert is not None:\n if isinstance(client_cert, tuple) and len(client_cert) == 2:\n@@ -284,27 +295,26 @@ def cert_verify(self, conn, url, verify, cert):\n :param cert: The SSL certificate to verify.\n \"\"\"\n if url.lower().startswith(\"https\") and verify:\n- cert_loc = None\n+ conn.cert_reqs = \"CERT_REQUIRED\"\n \n- # Allow self-specified cert location.\n+ # Only load the CA certificates if 'verify' is a string indicating the CA bundle to use.\n+ # Otherwise, if verify is a boolean, we don't load anything since\n+ # the connection will be using a context with the default certificates already loaded,\n+ # and this avoids a call to the slow load_verify_locations()\n if verify is not True:\n+ # `verify` must be a str with a path then\n cert_loc = verify\n \n- if not cert_loc:\n- cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)\n-\n- if not cert_loc or not os.path.exists(cert_loc):\n- raise OSError(\n- f\"Could not find a suitable TLS CA certificate bundle, \"\n- f\"invalid path: {cert_loc}\"\n- )\n+ if not os.path.exists(cert_loc):\n+ raise OSError(\n+ f\"Could not find a suitable TLS CA certificate bundle, \"\n+ f\"invalid path: {cert_loc}\"\n+ )\n \n- conn.cert_reqs = \"CERT_REQUIRED\"\n-\n- if not os.path.isdir(cert_loc):\n- conn.ca_certs = cert_loc\n- else:\n- conn.ca_cert_dir = cert_loc\n+ if not os.path.isdir(cert_loc):\n+ conn.ca_certs = cert_loc\n+ else:\n+ conn.ca_cert_dir = cert_loc\n else:\n conn.cert_reqs = \"CERT_NONE\"\n conn.ca_certs = None"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1950596425,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2024-03-21T01:46:24+00:00"
+ },
+ {
+ "id": 1951613196,
+ "user": "user_14f21d37ae53",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-03-21T10:14:37+00:00"
+ },
+ {
+ "id": 2052657681,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": "Just want a second set of eyes from [USER_REDACTED] or [USER_REDACTED]",
+ "submitted_at": "2024-05-13T13:10:49+00:00"
+ },
+ {
+ "id": 2058899428,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Cool, this seems reasonable to me. I was curious if we'd be better off doing this per-Adapter instance instead of globally but it seems like that may not be a concern with Christian's response.",
+ "submitted_at": "2024-05-15T20:01:59+00:00"
+ },
+ {
+ "id": 2397673664,
+ "user": "user_adf270769e63",
+ "state": "COMMENTED",
+ "body": "Run nodes debug merge",
+ "submitted_at": "2024-10-28T00:08:02+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1533138744,
+ "user": "user_0fa58b6f3572",
+ "body": "This is actually critical behavior you're removing",
+ "path": "src/requests/adapters.py",
+ "line": 294,
+ "side": "LEFT",
+ "created_at": "2024-03-21T01:45:42+00:00"
+ },
+ {
+ "id": 1533587993,
+ "user": "user_14f21d37ae53",
+ "body": "Thanks for the catch, I had to adapt the patch quite a bit from what we're using right now and that inconsistency slipped by.\n\nI pushed a change to explicitly use `DEFAULT_CA_BUNDLE_PATH` when `verify=True`. This is done by creating a module-level `SSLContext` with that bundle already loaded, and instructing the connection pool to use that context when no custom bundle is specified. Since the server's cert is verified using the CA certificates loaded in the `SSLContext` used in the request, this should work.\n\nAgain, the goal is to avoid setting `ca_certs` or `ca_cert_dir` in the most common use case as it triggers another (in this case redundant) call to `load_verify_locations()` by urllib3:\n\n```py\nif ca_certs or ca_cert_dir or ca_cert_data:\n try:\n context.load_verify_locations(ca_certs, ca_cert_dir, ca_cert_data)\n```\n\nSince `DEFAULT_CA_BUNDLE_PATH` is sugar for `certifi.where()`, which in turn always returns the path to a single bundle file, I decided to skip checking for `os.path.isdir()` because it should always be False. If you're not comfortable with this please let me know and I'll change it.\n\nI also changed `_urllib3_request_context()` slightly to handle the case where `verify` is a path to a dir instead to a single file, as we should set `ca_cert_dir` instead of `ca_certs` in that case. I believe this is now fully redundant with the corresponding logic in `cert_verify()`.\n\nI tried to write corresponding tests to verify that the `SSLContext`s used in different scenarios have the correct certificates loaded, but I couldn't find a way to access such low-level information about a request in the exposed classes. If it's possible, please give me a few pointers and I'll be glad to expand the test suite.",
+ "path": "src/requests/adapters.py",
+ "line": 294,
+ "side": "LEFT",
+ "created_at": "2024-03-21T10:14:37+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 2,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "6706636b7f88e108",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.378696+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6655,
+ "title": "Use TLS settings in selecting connection pool",
+ "body": "Previously, if someone made a request with `verify=False` then made a request where they expected verification to be enabled to the same host, they would potentially reuse a connection where TLS had not been verified.\n\nThis fixes that issue.",
+ "author": "user_0fa58b6f3572",
+ "created_at": "2024-03-03T13:05:10+00:00",
+ "merged_at": "2024-03-11T11:21:59+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-tls-floppy",
+ "additions": 65,
+ "deletions": 2,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 57,
+ "deletions": 1,
+ "changes": 58,
+ "patch": "@@ -8,6 +8,7 @@\n \n import os.path\n import socket # noqa: F401\n+import typing\n \n from urllib3.exceptions import ClosedPoolError, ConnectTimeoutError\n from urllib3.exceptions import HTTPError as _HTTPError\n@@ -61,12 +62,38 @@ def SOCKSProxyManager(*args, **kwargs):\n raise InvalidSchema(\"Missing dependencies for SOCKS support.\")\n \n \n+if typing.TYPE_CHECKING:\n+ from .models import PreparedRequest\n+\n+\n DEFAULT_POOLBLOCK = False\n DEFAULT_POOLSIZE = 10\n DEFAULT_RETRIES = 0\n DEFAULT_POOL_TIMEOUT = None\n \n \n+def _urllib3_request_context(\n+ request: \"PreparedRequest\", verify: \"bool | str | None\"\n+) -> \"(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])\":\n+ host_params = {}\n+ pool_kwargs = {}\n+ parsed_request_url = urlparse(request.url)\n+ scheme = parsed_request_url.scheme.lower()\n+ port = parsed_request_url.port\n+ cert_reqs = \"CERT_REQUIRED\"\n+ if verify is False:\n+ cert_reqs = \"CERT_NONE\"\n+ if isinstance(verify, str):\n+ pool_kwargs[\"ca_certs\"] = verify\n+ pool_kwargs[\"cert_reqs\"] = cert_reqs\n+ host_params = {\n+ \"scheme\": scheme,\n+ \"host\": parsed_request_url.hostname,\n+ \"port\": port,\n+ }\n+ return host_params, pool_kwargs\n+\n+\n class BaseAdapter:\n \"\"\"The Base Transport Adapter\"\"\"\n \n@@ -327,6 +354,35 @@ def build_response(self, req, resp):\n \n return response\n \n+ def _get_connection(self, request, verify, proxies=None):\n+ # Replace the existing get_connection without breaking things and\n+ # ensure that TLS settings are considered when we interact with\n+ # urllib3 HTTP Pools\n+ proxy = select_proxy(request.url, proxies)\n+ try:\n+ host_params, pool_kwargs = _urllib3_request_context(request, verify)\n+ except ValueError as e:\n+ raise InvalidURL(e, request=request)\n+ if proxy:\n+ proxy = prepend_scheme_if_needed(proxy, \"http\")\n+ proxy_url = parse_url(proxy)\n+ if not proxy_url.host:\n+ raise InvalidProxyURL(\n+ \"Please check proxy URL. It is malformed \"\n+ \"and could be missing the host.\"\n+ )\n+ proxy_manager = self.proxy_manager_for(proxy)\n+ conn = proxy_manager.connection_from_host(\n+ **host_params, pool_kwargs=pool_kwargs\n+ )\n+ else:\n+ # Only scheme should be lower case\n+ conn = self.poolmanager.connection_from_host(\n+ **host_params, pool_kwargs=pool_kwargs\n+ )\n+\n+ return conn\n+\n def get_connection(self, url, proxies=None):\n \"\"\"Returns a urllib3 connection for the given URL. This should not be\n called from user code, and is only exposed for use when subclassing the\n@@ -453,7 +509,7 @@ def send(\n \"\"\"\n \n try:\n- conn = self.get_connection(request.url, proxies)\n+ conn = self._get_connection(request, verify, proxies)\n except LocationValueError as e:\n raise InvalidURL(e, request=request)"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 0,
+ "changes": 7,
+ "patch": "@@ -2828,6 +2828,13 @@ def test_status_code_425(self):\n assert r5 == 425\n assert r6 == 425\n \n+ def test_different_connection_pool_for_tls_settings(self):\n+ s = requests.Session()\n+ r1 = s.get(\"https://invalid.badssl.com\", verify=False)\n+ assert r1.status_code == 421\n+ with pytest.raises(requests.exceptions.SSLError):\n+ s.get(\"https://invalid.badssl.com\")\n+\n \n def test_json_decode_errors_are_serializable_deserializable():\n json_decode_error = requests.exceptions.JSONDecodeError("
+ },
+ {
+ "filename": "tox.ini",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -7,7 +7,7 @@ extras =\n security\n socks\n commands =\n- pytest tests\n+ pytest {posargs:tests}\n \n [testenv:default]"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1920906731,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-03-10T16:33:49+00:00"
+ },
+ {
+ "id": 1926588901,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-03-10T17:11:39+00:00"
+ },
+ {
+ "id": 1926589195,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-03-10T17:12:49+00:00"
+ },
+ {
+ "id": 1926592022,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": ":shipit:",
+ "submitted_at": "2024-03-10T17:18:05+00:00"
+ },
+ {
+ "id": 1927570372,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-03-11T11:21:54+00:00"
+ },
+ {
+ "id": 2342567877,
+ "user": "user_e6d1de3927d6",
+ "state": "COMMENTED",
+ "body": "Thank you",
+ "submitted_at": "2024-10-02T10:27:22+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1515206804,
+ "user": "user_dbf2a999bd6d",
+ "body": "Not against this, but I think this is the first time we're introducing typing into Requests. I'm curious if we want to start that or push it into typeshed since this will be precedent for future inline typing?",
+ "path": "src/requests/adapters.py",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2024-03-06T21:56:23+00:00"
+ },
+ {
+ "id": 1518892861,
+ "user": "user_dbf2a999bd6d",
+ "body": "There may not be a better way to test this but I don't know if we have other tests that require contacting a live site with TLS disabled. That may have some durability issues and means we're going to take the first response we get back. Probably minor, but figured I'd call it out.",
+ "path": "tests/test_requests.py",
+ "line": 2836,
+ "side": "RIGHT",
+ "created_at": "2024-03-10T16:33:36+00:00"
+ },
+ {
+ "id": 1518900181,
+ "user": "user_0fa58b6f3572",
+ "body": "This is for a private method (that I fully anticipate people abusing) but we're not advertising things are typed and so it's not something I'm concerned with.",
+ "path": "src/requests/adapters.py",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2024-03-10T17:11:39+00:00"
+ },
+ {
+ "id": 1518900465,
+ "user": "user_0fa58b6f3572",
+ "body": "There are many alternatives here, but those are all significantly more effort and this shows the behaviour is fixed before and after handily. I'm sure Linux folks will get pissed but I'm not as bothered about finding time later to do this a different way after we have fixed this",
+ "path": "tests/test_requests.py",
+ "line": 2836,
+ "side": "RIGHT",
+ "created_at": "2024-03-10T17:12:49+00:00"
+ },
+ {
+ "id": 1519559679,
+ "user": "user_0fa58b6f3572",
+ "body": "I'll try to prioritize better (offline) tests soon",
+ "path": "tests/test_requests.py",
+ "line": 2836,
+ "side": "RIGHT",
+ "created_at": "2024-03-11T11:21:54+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "ini",
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 5,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 5
+ }
+}
+{
+ "_id": "72d526f7862e2149",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.393484+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6644,
+ "title": "Trim excess leading path separators",
+ "body": "A URL with excess leading / (path-separator)s would cause urllib3 to attempt to reparse the request-uri as a full URI with a host and port. This bypasses that logic in ConnectionPool.urlopen by [NAME_REDACTED] /s with just a single /.\n\nCloses #6643",
+ "author": "user_0fa58b6f3572",
+ "created_at": "2024-02-22T01:11:15+00:00",
+ "merged_at": "2024-02-23T00:49:42+00:00",
+ "base_branch": "main",
+ "head_branch": "bug/6643",
+ "additions": 11,
+ "deletions": 0,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "src/requests/adapters.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -390,6 +390,9 @@ def request_url(self, request, proxies):\n using_socks_proxy = proxy_scheme.startswith(\"socks\")\n \n url = request.path_url\n+ if url.startswith(\"//\"): # Don't confuse urllib3\n+ url = f\"/{url.lstrip('/')}\"\n+\n if is_proxied_http_request and not using_socks_proxy:\n url = urldefragauth(request.url)"
+ },
+ {
+ "filename": "tests/test_adapters.py",
+ "status": "added",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -0,0 +1,8 @@\n+import requests.adapters\n+\n+\n+def test_request_url_trims_leading_path_separators():\n+ \"\"\"See also https://github.com/psf/requests/issues/6643.\"\"\"\n+ a = requests.adapters.HTTPAdapter()\n+ p = requests.Request(method=\"GET\", url=\"http://127.0.0.1:10000//v:h\").prepare()\n+ assert \"/v:h\" == a.request_url(p, {})"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1894724059,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T01:55:27+00:00"
+ },
+ {
+ "id": 1894741153,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T02:18:04+00:00"
+ },
+ {
+ "id": 1894743966,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T02:21:43+00:00"
+ },
+ {
+ "id": 1894751684,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T02:32:04+00:00"
+ },
+ {
+ "id": 1895756007,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T12:39:14+00:00"
+ },
+ {
+ "id": 1896264588,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T16:10:48+00:00"
+ },
+ {
+ "id": 1896266764,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-02-22T16:11:44+00:00"
+ },
+ {
+ "id": 1896601426,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T18:22:38+00:00"
+ },
+ {
+ "id": 1896817321,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-22T19:44:36+00:00"
+ },
+ {
+ "id": 1897227706,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-02-23T00:49:39+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1498520667,
+ "user": "user_0fa58b6f3572",
+ "body": "```suggestion\nimport requests.adapters\n```",
+ "path": "tests/test_adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T01:55:22+00:00"
+ },
+ {
+ "id": 1498532708,
+ "user": "user_0fa58b6f3572",
+ "body": "```suggestion\n a = requests.adapters.HTTPAdapter()\n```",
+ "path": "tests/test_adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T02:17:57+00:00"
+ },
+ {
+ "id": 1498534695,
+ "user": "user_0fa58b6f3572",
+ "body": "```suggestion\n assert \"/v:h\" == a.request_url(\"http://127.0.0.1:10000//v:h\", {})\n```",
+ "path": "tests/test_adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T02:21:39+00:00"
+ },
+ {
+ "id": 1498539954,
+ "user": "user_0fa58b6f3572",
+ "body": "```suggestion\n p = requests.Request(method=\"GET\", url=\"http://127.0.0.1:10000//v:h\").prepare()\n assert \"/v:h\" == a.request_url(p, {})\n```",
+ "path": "tests/test_adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T02:31:51+00:00"
+ },
+ {
+ "id": 1499181040,
+ "user": "user_0fa58b6f3572",
+ "body": "As mentioned on https://github.com/urllib3/urllib3/issues/3352 this could also be\n\n```python\nurl = f\"/{request.path_url.lstrip('/')}\"\n```\n\nI could benchmark these but I don't particularly care what the implementation is. I just threw this together to show that it can be fixed",
+ "path": "src/requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T12:39:14+00:00"
+ },
+ {
+ "id": 1499501563,
+ "user": "user_dbf2a999bd6d",
+ "body": "It looks like the f-string (Python 3.9-3.12 tested) is ~4x faster but we're talking on the scale of nanoseconds so it's basically moot. I'd vote the f-string for readability, but don't have a strong opinion.",
+ "path": "src/requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T16:10:48+00:00"
+ },
+ {
+ "id": 1499711431,
+ "user": "user_0fa58b6f3572",
+ "body": "Yeah, I'm also happy to shove this into a branch too like \n\n```python\nif path.startswith('//'):\n```\n\nTo make it clearer that we only care about the separator being repeated. What I want is clarity in the reader as to why we're doing this. My old school brain things the regexp is clearer and the f-string looks sus but that's just my opinion and I'm not holding it closely",
+ "path": "src/requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T18:22:38+00:00"
+ },
+ {
+ "id": 1499848845,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yeah, branching seems fine to me too.",
+ "path": "src/requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-22T19:44:35+00:00"
+ },
+ {
+ "id": 1500110895,
+ "user": "user_0fa58b6f3572",
+ "body": "Did both (f string and branch)",
+ "path": "src/requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2024-02-23T00:49:38+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 9,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 9,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 9
+ }
+}
+{
+ "_id": "e33a38a85cecae58",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.393484+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6600,
+ "title": "Add note on connection timeout being larger than specified. Fix #5773",
+ "body": "[As requested](https://github.com/psf/requests/issues/5773#issuecomment-799787382), here's my take on a PR to improve documentation. I've tried to incorporate the [suggestions made by [USER_REDACTED] at a previous PR](https://github.com/psf/requests/pull/5776#discussion_r596043195), by [NAME_REDACTED] \"IPv4+IPv6\" particular case to a more general (and correct) \"multiple IPs\" scenario.\n\nIf approved, this PR will also fix #5760, and supersede PRs #5776 and #6597",
+ "author": "user_5b66c2b56f87",
+ "created_at": "2023-12-13T13:19:43+00:00",
+ "merged_at": "2023-12-16T13:30:18+00:00",
+ "base_branch": "main",
+ "head_branch": "MestreLion-connection-timeout-note",
+ "additions": 14,
+ "deletions": 0,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 0,
+ "changes": 14,
+ "patch": "@@ -1122,4 +1122,18 @@ coffee.\n \n r = requests.get('https://github.com', timeout=None)\n \n+.. note:: The connect timeout applies to each connection attempt to an IP address.\n+ If multiple addresses exist for a domain name, the underlying ``urllib3`` will\n+ try each address sequentially until one successfully connects.\n+ This may lead to an effective total connection timeout *multiple* times longer\n+ than the specified time, e.g. an unresponsive server having both IPv4 and IPv6\n+ addresses will have its perceived timeout *doubled*, so take that into account\n+ when setting the connection timeout.\n+.. note:: Neither the connect nor read timeouts are `wall clock`_. This means\n+ that if you start a request, and look at the time, and then look at\n+ the time when the request finishes or times out, the real-world time\n+ may be greater than what you specified.\n+\n+\n+.. _`wall clock`: https://wiki.php.net/rfc/max_execution_wall_time\n .. _`connect()`: https://linux.die.net/man/2/connect"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1785178531,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-12-16T13:26:09+00:00"
+ },
+ {
+ "id": 1785178796,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-12-16T13:29:17+00:00"
+ },
+ {
+ "id": 1785178884,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2023-12-16T13:30:11+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1428809820,
+ "user": "user_0fa58b6f3572",
+ "body": "This should be indented. It should all be indented to match the start of \"The\" on the previous line\n\n```suggestion\n If multiple addresses exist for a domain name, the underlying ``urllib3`` will\n try each address sequentially until one successfully connects.\n This may lead to an effective total connection timeout *multiple* times longer\n than the specified time, e.g. an unresponsive server having both IPv4 and IPv6\n addresses will have its perceived timeout *doubled*, so take that into account\n when setting the connection timeout.\n```",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-12-16T13:26:09+00:00"
+ },
+ {
+ "id": 1428810474,
+ "user": "user_0fa58b6f3572",
+ "body": "I would also suggest we add:\n\n```suggestion\n.. note:: Neither the connect nor read timeouts are `wall clock`_. This means\n that if you start a request, and look at the time, and then look at\n the time when the request finishes or times out, the real-world time\n may be greater than what you specified.\n\n.. _`wall clock`: https://wiki.php.net/rfc/max_execution_wall_time\n```",
+ "path": "docs/user/advanced.rst",
+ "line": 1136,
+ "side": "RIGHT",
+ "created_at": "2023-12-16T13:29:17+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "5819f52704ede042",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.394523+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6589,
+ "title": "Enhance `super_len` to count encoded bytes for str",
+ "body": "This is a possible fix for issue #6586.\n\nI am not at all confident that this is an appropriate change for Requests. All of the unit tests pass locally for me (specifically `make ci`).",
+ "author": "user_3f1e3970e9ae",
+ "created_at": "2023-11-28T18:21:03+00:00",
+ "merged_at": "2024-02-23T00:53:25+00:00",
+ "base_branch": "main",
+ "head_branch": "super_len_str_utf-8",
+ "additions": 20,
+ "deletions": 0,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "src/requests/utils.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -134,6 +134,9 @@ def super_len(o):\n total_length = None\n current_position = 0\n \n+ if isinstance(o, str):\n+ o = o.encode(\"utf-8\")\n+\n if hasattr(o, \"__len__\"):\n total_length = len(o)"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 17,
+ "deletions": 0,
+ "changes": 17,
+ "patch": "@@ -1808,6 +1808,23 @@ def test_autoset_header_values_are_native(self, httpbin):\n \n assert p.headers[\"Content-Length\"] == length\n \n+ def test_content_length_for_bytes_data(self, httpbin):\n+ data = \"This is a string containing multi-byte UTF-8 ☃️\"\n+ encoded_data = data.encode(\"utf-8\")\n+ length = str(len(encoded_data))\n+ req = requests.Request(\"POST\", httpbin(\"post\"), data=encoded_data)\n+ p = req.prepare()\n+\n+ assert p.headers[\"Content-Length\"] == length\n+\n+ def test_content_length_for_string_data_counts_bytes(self, httpbin):\n+ data = \"This is a string containing multi-byte UTF-8 ☃️\"\n+ length = str(len(data.encode(\"utf-8\")))\n+ req = requests.Request(\"POST\", httpbin(\"post\"), data=data)\n+ p = req.prepare()\n+\n+ assert p.headers[\"Content-Length\"] == length\n+\n def test_nonhttp_schemes_dont_check_URLs(self):\n test_urls = (\n \"data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==\","
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1755293955,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2023-11-29T13:38:48+00:00"
+ },
+ {
+ "id": 1755335199,
+ "user": "user_3f1e3970e9ae",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-29T13:57:59+00:00"
+ },
+ {
+ "id": 1755377661,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-29T14:16:41+00:00"
+ },
+ {
+ "id": 1896890206,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "I'll leave any final comments and merging to [USER_REDACTED] but this looks reasonable to me. Thanks [USER_REDACTED]!",
+ "submitted_at": "2024-02-22T20:30:04+00:00"
+ },
+ {
+ "id": 1897230775,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-02-23T00:53:03+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1409296382,
+ "user": "user_0fa58b6f3572",
+ "body": "More simply this can be an if without changing the following conditions and just set `o = o.encode(...)` in the block then let the rest of the logic work. As it will hit another condition which will get it's length",
+ "path": "src/requests/utils.py",
+ "line": 137,
+ "side": "RIGHT",
+ "created_at": "2023-11-29T13:38:39+00:00"
+ },
+ {
+ "id": 1409321632,
+ "user": "user_3f1e3970e9ae",
+ "body": "Sounds fine to me. My usual workflow would be to rewrite my commit and do a force push to my branch (in my fork). Is this ok or would you prefer a separate commit for the change?",
+ "path": "src/requests/utils.py",
+ "line": 137,
+ "side": "RIGHT",
+ "created_at": "2023-11-29T13:57:59+00:00"
+ },
+ {
+ "id": 1409347860,
+ "user": "user_0fa58b6f3572",
+ "body": "That's my workflow as well. Feel free to do that",
+ "path": "src/requests/utils.py",
+ "line": 137,
+ "side": "RIGHT",
+ "created_at": "2023-11-29T14:16:40+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 2,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "5fcd4a7ce90c08e4",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.396174+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6583,
+ "title": "Fix broken links in docs",
+ "body": "Hi,\n\nI noticed a broken link to rfc2988 in the [timeout section of the docs](https://requests.readthedocs.io/en/latest/user/advanced/#timeouts) and thought I would fix it.\n\nWhile doing that, I thought I would run the sphinx `linkcheck` builder to check for other broken links and fix them.\n\nThere were a few, some where I've 'fixed'/updated the link are hopefully uncontroversial. \n\nSome are more controversial - removing sections written by [NAME_REDACTED] requests that now have dead links, removing talks with dead links to slides, removing people's now dead GitHub account links. I wasn't sure what the right thing to do here was, but I went with my intuition, and kept commits pretty discrete so I can drop/amend them if the maintainers want me to do something different. If some are controversial enough to slow down the PR, I can always pull out the uncontroversial ones into their own PR for faster merging.",
+ "author": "user_623591bfa86c",
+ "created_at": "2023-11-24T11:23:44+00:00",
+ "merged_at": "2024-02-23T11:30:46+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-broken-links",
+ "additions": 5,
+ "deletions": 8,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -8,7 +8,7 @@ Keepers of the [NAME_REDACTED] of Crystals\n ````````````````````````````\n-- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED], reluctant Keeper of the Master Crystal.\n+- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED], reluctant Keeper of the Master Crystal.\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]"
+ },
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -14,7 +14,7 @@ dev\n forwarding of `Proxy-Authorization` headers to destination servers when\n following HTTPS redirects.\n \n- When proxies are defined with user info (https://user:pass@proxy:8080), Requests\n+ When proxies are defined with user info (`https://user:pass@proxy:8080`), Requests\n will construct a `Proxy-Authorization` header that is attached to the request to\n authenticate with the proxy."
+ },
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -291,7 +291,7 @@ versions of Requests.\n For the sake of security we recommend upgrading certifi frequently!\n \n .. _HTTP persistent connection: https://en.wikipedia.org/wiki/HTTP_persistent_connection\n-.. _connection pooling: https://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool\n+.. _connection pooling: https://urllib3.readthedocs.io/en/latest/reference/urllib3.connectionpool.html\n .. _certifi: https://certifiio.readthedocs.io/\n .. _Mozilla trust store: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt\n \n@@ -948,7 +948,7 @@ [NAME_REDACTED] HTTP APIs feature Link headers. They make APIs more self describing and\n discoverable.\n \n-GitHub uses these for `pagination `_\n+GitHub uses these for `pagination `_\n in their API, for example::\n \n >>> url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'\n@@ -1099,7 +1099,7 @@ The **connect** timeout is the number of seconds Requests will wait for your\n client to establish a connection to a remote machine (corresponding to the\n `connect()`_) call on the socket. It's a good practice to set connect timeouts\n to slightly larger than a multiple of 3, which is the default `TCP packet\n-retransmission window `_.\n+retransmission window `_.\n \n Once your client has connected to the server and sent the HTTP request, the\n **read** timeout is the number of seconds the client will wait for the server"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 3,
+ "changes": 3,
+ "patch": "@@ -568,6 +568,3 @@ All exceptions that Requests explicitly raises inherit from\n -----------------------\n \n Ready for more? Check out the :ref:`advanced ` section.\n-\n-\n-If you're on the job market, consider taking `this programming quiz `_. A substantial donation will be made to this project, if you find a job through this platform."
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1747785992,
+ "user": "user_623591bfa86c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-24T11:25:12+00:00"
+ },
+ {
+ "id": 1747989322,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-24T13:52:52+00:00"
+ },
+ {
+ "id": 1747992792,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-24T13:55:17+00:00"
+ },
+ {
+ "id": 1748201605,
+ "user": "user_623591bfa86c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-24T16:31:47+00:00"
+ },
+ {
+ "id": 1748203081,
+ "user": "user_623591bfa86c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-11-24T16:33:18+00:00"
+ },
+ {
+ "id": 1844811166,
+ "user": "user_ab2c821ca104",
+ "state": "APPROVED",
+ "body": "That's great! Thank you, [USER_REDACTED]!\nI believe these changes are ready to be merged.",
+ "submitted_at": "2024-01-25T22:47:48+00:00"
+ },
+ {
+ "id": 1844844142,
+ "user": "user_ab2c821ca104",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-01-25T23:10:48+00:00"
+ },
+ {
+ "id": 1845312906,
+ "user": "user_623591bfa86c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2024-01-26T09:02:30+00:00"
+ },
+ {
+ "id": 1897910085,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2024-02-23T11:30:30+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1404248901,
+ "user": "user_623591bfa86c",
+ "body": "I believe this is a similar app by [NAME_REDACTED], but it's python 2.5 (long deprecated), and doesn't work on the most recent version of iOS anyway.\n\nI was tempted to just delete the whole 'Python for iOS' section here, but I thought I would see what a maintainer thought before deleting the whole section.",
+ "path": "docs/community/out-there.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-11-24T11:25:11+00:00"
+ },
+ {
+ "id": 1404377720,
+ "user": "user_0fa58b6f3572",
+ "body": "This is actually an easy one to fix: https://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html is from the very old GitHub pages and they switched the domain from `github.com` to `github.io`",
+ "path": "docs/community/out-there.rst",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2023-11-24T13:52:52+00:00"
+ },
+ {
+ "id": 1404379931,
+ "user": "user_0fa58b6f3572",
+ "body": "I'd rather not remove these. I don't think there's value in removing these links to folks even if they've deleted their account.",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2023-11-24T13:55:17+00:00"
+ },
+ {
+ "id": 1404515378,
+ "user": "user_623591bfa86c",
+ "body": "ah, can't believe I didn't think of that 🤦 Thanks for finding it!\n\nI've updated the commit to 'fix' it to the correct link rather than removing the line.",
+ "path": "docs/community/out-there.rst",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2023-11-24T16:31:47+00:00"
+ },
+ {
+ "id": 1404516420,
+ "user": "user_623591bfa86c",
+ "body": "Fair enough - I've removed all cases like this from the relevant commit.\n\nI've left in the case where the GitHub user has changed, but let me know if you want me to remove that too.",
+ "path": "AUTHORS.rst",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2023-11-24T16:33:18+00:00"
+ },
+ {
+ "id": 1467061330,
+ "user": "user_ab2c821ca104",
+ "body": "> It's a good practice to set connect timeouts to slightly larger than a multiple of 3, which is the default [TCP packet retransmission window](https://datatracker.ietf.org/doc/html/rfc2988).\n\nDespite the fact I already approved this PR, there's still a room for improvement.\n[RFC 2988](https://datatracker.ietf.org/doc/html/rfc2988) was obsoleted by [RFC 6298](https://datatracker.ietf.org/doc/html/rfc6298), so this link might be updated even further, but it would require additional changes since newer RFC makes the whole statement not correct due to [this change](https://datatracker.ietf.org/doc/html/rfc6298#section-7).\nSo this might be handled in an additional PR.",
+ "path": "docs/user/advanced.rst",
+ "line": 1102,
+ "side": "RIGHT",
+ "created_at": "2024-01-25T23:10:48+00:00"
+ },
+ {
+ "id": 1467381716,
+ "user": "user_623591bfa86c",
+ "body": "Thanks - seems like a sensible comment, agree it makes sense for an additional PR.",
+ "path": "docs/user/advanced.rst",
+ "line": 1102,
+ "side": "RIGHT",
+ "created_at": "2024-01-26T09:02:30+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 7,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 7,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 7
+ }
+}
+{
+ "_id": "d074ad4096637c58",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.397675+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6527,
+ "title": "Autoclose specific issue templates",
+ "body": "We spend a fair amount of time closing issues because people don't read the template closely or understand what they're being told. Let's take advantage of being able to auto-label an issue based on the template and then trigger a workflow to auto-magically close the issue with a message and lock the issue.",
+ "author": "user_0fa58b6f3572",
+ "created_at": "2023-09-13T14:36:49+00:00",
+ "merged_at": "2023-10-11T16:29:20+00:00",
+ "base_branch": "main",
+ "head_branch": "update-templates",
+ "additions": 39,
+ "deletions": 0,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": ".github/ISSUE_TEMPLATE/Custom.md",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -1,6 +1,9 @@\n ---\n name: Request for Help\n about: Guidance on using Requests.\n+labels:\n+- \"Question/Not a bug\"\n+- \"actions/autoclose-qa\"\n \n ---"
+ },
+ {
+ "filename": ".github/ISSUE_TEMPLATE/Feature_request.md",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -1,6 +1,9 @@\n ---\n name: Feature request\n about: Suggest an idea for this project\n+labels:\n+- \"[NAME_REDACTED]\"\n+- \"actions/autoclose-feat\"\n \n ---"
+ },
+ {
+ "filename": ".github/workflows/close-issues.yml",
+ "status": "added",
+ "additions": 33,
+ "deletions": 0,
+ "changes": 33,
+ "patch": "@@ -0,0 +1,33 @@\n+name: '[NAME_REDACTED]'\n+\n+on:\n+ issues:\n+ types:\n+ - labeled\n+\n+permissions:\n+ issues: write\n+\n+jobs:\n+ close_qa:\n+ if: github.event.label.name == 'actions/autoclose-qa'\n+ runs-on: ubuntu-latest\n+ steps:\n+ - env:\n+ ISSUE_URL: ${{ github.event.issue.html_url }}\n+ run: |\n+ gh issue close $ISSUE_URL \\\n+ --comment \"As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow](https://stackoverflow.com/)\" \\\n+ --reason completed\n+ gh issue lock $ISSUE_URL --reason off_topic\n+ close_feature_request:\n+ if: github.event.label.name == 'actions/autoclose-feat'\n+ runs-on: ubuntu-latest\n+ steps:\n+ - env:\n+ ISSUE_URL: ${{ github.event.issue.html_url }}\n+ run: |\n+ gh issue close $ISSUE_URL \\\n+ --comment \"As described in the template, Requests is not accepting feature requests\" \\\n+ --reason \"not planned\"\n+ gh issue lock $ISSUE_URL --reason off_topic"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1631822927,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": "Two minor comments, otherwise looks good.",
+ "submitted_at": "2023-09-19T16:22:59+00:00"
+ },
+ {
+ "id": 1641078032,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-09-24T15:19:47+00:00"
+ },
+ {
+ "id": 1671225473,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2023-10-11T13:20:51+00:00"
+ },
+ {
+ "id": 1671831769,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2023-10-11T16:28:10+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1329187398,
+ "user": "user_dbf2a999bd6d",
+ "body": "I'm not familiar, what is `MY_TOKEN` in this case? Should this be `GITHUB_TOKEN` or were you planning on adding a separate token specifically for this workflow?",
+ "path": ".github/workflows/close-issues.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-09-18T19:29:12+00:00"
+ },
+ {
+ "id": 1329188753,
+ "user": "user_dbf2a999bd6d",
+ "body": "nit on phrasing.\n```suggestion\n --comment \"As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow](https://stackoverflow.com/)\" \\\n```",
+ "path": ".github/workflows/close-issues.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-09-18T19:30:51+00:00"
+ },
+ {
+ "id": 1335203087,
+ "user": "user_0fa58b6f3572",
+ "body": "Ah yeah, I based this heavily off the actions docs and didn't look terribly closely at this. I don't think it's necessary honestly",
+ "path": ".github/workflows/close-issues.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-09-24T15:19:47+00:00"
+ },
+ {
+ "id": 1355002832,
+ "user": "user_0fa58b6f3572",
+ "body": "Removed those",
+ "path": ".github/workflows/close-issues.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2023-10-11T13:20:51+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "a02a94c08dd90291",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.398677+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6436,
+ "title": "v2.30.0",
+ "body": "2.30.0 (2023-05-03)\n-------------------\n\n**Dependencies**\n- ⚠️ Added support for urllib3 2.0. ⚠️\n\n This may contain minor breaking changes so we advise careful testing and\n reviewing https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html\n prior to upgrading.\n\n Users who wish to stay on urllib3 1.x can pin to `urllib3<2`.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2023-05-03T15:27:01+00:00",
+ "merged_at": "2023-05-03T15:39:44+00:00",
+ "base_branch": "main",
+ "head_branch": "v2.30.0",
+ "additions": 19,
+ "deletions": 7,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 0,
+ "changes": 12,
+ "patch": "@@ -6,6 +6,18 @@ dev\n \n - \\[Short description of non-trivial change.\\]\n \n+2.30.0 (2023-05-03)\n+-------------------\n+\n+**Dependencies**\n+- ⚠️ Added support for urllib3 2.0. ⚠️\n+\n+ This may contain minor breaking changes so we advise careful testing and\n+ reviewing https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html\n+ prior to upgrading.\n+\n+ Users who wish to stay on urllib3 1.x can pin to `urllib3<2`.\n+\n 2.29.0 (2023-04-26)\n -------------------"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 4,
+ "changes": 8,
+ "patch": "@@ -66,10 +66,10 @@ def check_compatibility(urllib3_version, chardet_version, charset_normalizer_ver\n # Check urllib3 for compatibility.\n major, minor, patch = urllib3_version # noqa: F811\n major, minor, patch = int(major), int(minor), int(patch)\n- # urllib3 >= 1.21.1, <= 1.26\n- assert major == 1\n- assert minor >= 21\n- assert minor <= 26\n+ # urllib3 >= 1.21.1\n+ assert major >= 1\n+ if major == 1:\n+ assert minor >= 21\n \n # Check charset_normalizer for compatibility.\n if chardet_version:"
+ },
+ {
+ "filename": "requests/__version__.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -5,8 +5,8 @@\n __title__ = \"requests\"\n __description__ = \"Python HTTP for Humans.\"\n __url__ = \"https://requests.readthedocs.io\"\n-__version__ = \"2.29.0\"\n-__build__ = 0x022900\n+__version__ = \"2.30.0\"\n+__build__ = 0x023000\n __author__ = \"[NAME_REDACTED]\"\n __author_email__ = \"[EMAIL_REDACTED]\"\n __license__ = \"Apache 2.0\""
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -61,7 +61,7 @@ def run_tests(self):\n requires = [\n \"charset_normalizer>=2,<4\",\n \"idna>=2.5,<4\",\n- \"urllib3>=1.21.1,<1.27\",\n+ \"urllib3>=1.21.1,<3\",\n \"certifi>=2017.4.17\",\n ]\n test_requirements = ["
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1411163825,
+ "user": "user_c900b4a480af",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2023-05-03T15:29:03+00:00"
+ },
+ {
+ "id": 1411186494,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": ":shipit:",
+ "submitted_at": "2023-05-03T15:37:29+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1183862162,
+ "user": "user_b08fb5f52ea1",
+ "body": "<3",
+ "path": "setup.py",
+ "line": 64,
+ "side": "RIGHT",
+ "created_at": "2023-05-03T15:37:22+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 0,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "1012b6cf9c4f1a0d",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.399447+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6329,
+ "title": "v2.28.2",
+ "body": "2.28.2 (2023-01-12)\n-------------------\n\n**Dependencies**\n\n- Requests now supports charset\\_normalizer 3.x. (#6261)\n\n**Bugfixes**\n\n- Updated MissingSchema exception to suggest https scheme rather than http. (#6188)",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2023-01-11T22:39:35+00:00",
+ "merged_at": "2023-01-12T16:16:12+00:00",
+ "base_branch": "main",
+ "head_branch": "v2.28.2",
+ "additions": 14,
+ "deletions": 3,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 0,
+ "changes": 11,
+ "patch": "@@ -7,6 +7,17 @@ dev\n - \\[Short description of non-trivial change.\\]\n \n \n+2.28.2 (2023-01-12)\n+-------------------\n+\n+**Dependencies**\n+\n+- Requests now supports charset\\_normalizer 3.x. (#6261)\n+\n+**Bugfixes**\n+\n+- [NAME_REDACTED] exception to suggest https scheme rather than http. (#6188)\n+\n 2.28.1 (2022-06-29)\n -------------------"
+ },
+ {
+ "filename": "requests/__version__.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -5,10 +5,10 @@\n __title__ = \"requests\"\n __description__ = \"Python HTTP for Humans.\"\n __url__ = \"https://requests.readthedocs.io\"\n-__version__ = \"2.28.1\"\n-__build__ = 0x022801\n+__version__ = \"2.28.2\"\n+__build__ = 0x022802\n __author__ = \"[NAME_REDACTED]\"\n __author_email__ = \"[EMAIL_REDACTED]\"\n __license__ = \"Apache 2.0\"\n-__copyright__ = \"Copyright 2022 [NAME_REDACTED]\"\n+__copyright__ = \"[NAME_REDACTED]\"\n __cake__ = \"\\u2728 \\U0001f370 \\u2728\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1244716604,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "LGTM",
+ "submitted_at": "2023-01-11T22:40:56+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 1067529571,
+ "user": "user_b08fb5f52ea1",
+ "body": "🥳",
+ "path": "requests/__version__.py",
+ "line": 13,
+ "side": "LEFT",
+ "created_at": "2023-01-11T22:40:47+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 0,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "7b178dbd0cc52ce5",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.399447+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6157,
+ "title": "Add GitHub action to automate linting",
+ "body": "This was intended to be a follow up to #6095 but got lost in the shuffle post PyCon. It's currently failing on a single line change that's addressed in #6154. Once that's merged this should be ready to merge and ensure we don't introduce any future inconsistencies.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2022-06-08T04:19:31+00:00",
+ "merged_at": "2022-06-08T19:11:11+00:00",
+ "base_branch": "main",
+ "head_branch": "lint",
+ "additions": 16,
+ "deletions": 0,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": ".github/workflows/lint.yml",
+ "status": "added",
+ "additions": 16,
+ "deletions": 0,
+ "changes": 16,
+ "patch": "@@ -0,0 +1,16 @@\n+name: Lint code\n+\n+on:\n+ push:\n+ pull_request:\n+\n+jobs:\n+ lint:\n+ runs-on: ubuntu-20.04\n+\n+ steps:\n+ - uses: actions/checkout@v3\n+ - name: Set up Python\n+ uses: actions/setup-python@v3\n+ - name: Run pre-commit\n+ uses: pre-commit/action@v3.0.0"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1000278482,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "Looks good, one thought so you won't need to modify config in the future.",
+ "submitted_at": "2022-06-08T18:55:00+00:00"
+ },
+ {
+ "id": 1000286602,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-06-08T18:59:51+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 892750749,
+ "user": "user_b08fb5f52ea1",
+ "body": "Thoughts on following pre-commit's example config and use setup-python without specifying a Python version?",
+ "path": ".github/workflows/lint.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-08T18:54:28+00:00"
+ },
+ {
+ "id": 892756299,
+ "user": "user_dbf2a999bd6d",
+ "body": "Fine by me, I'd brought this over from other projects but we can switch to `actions/setup-python@v3` per their Readme.",
+ "path": ".github/workflows/lint.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-08T18:59:51+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "beb64c49747145b5",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.401488+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6156,
+ "title": "v2.28.0",
+ "body": "2.28.0 (2022-06-09)\n-------------------\n\n**Deprecations**\n\n- ⚠️ Requests has officially dropped support for Python 2.7. ⚠️ (#6091)\n- Requests has officially dropped support for Python 3.6 (including pypy3). (#6091)\n\n**Improvements**\n\n- Wrap JSON parsing issues in Request's JSONDecodeError for payloads without\n an encoding to make `json()` API consistent. (#6097)\n- Parse header components consistently, raising an InvalidHeader error in\n all invalid cases. (#6154)\n- Added provisional 3.11 support with current beta build. (#6155)\n- Requests got a makeover and we decided to paint it black. (#6095)\n\n**Bugfixes**\n\n- Fixed bug where setting `CURL_CA_BUNDLE` to an empty string would disable\n cert verification. All Requests 2.x versions before 2.28.0 are affected. (#6074)\n- Fixed urllib3 exception leak, wrapping `urllib3.exceptions.SSLError` with\n `requests.exceptions.SSLError` for `content` and `iter_content`. (#6057)\n- Fixed issue where invalid Windows registry entires caused proxy resolution\n to raise an exception rather than ignoring the entry. (#6149)\n- Fixed issue where entire payload could be included in the error message for\n JSONDecodeError. (#6079",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2022-06-08T04:10:18+00:00",
+ "merged_at": "2022-06-09T14:42:10+00:00",
+ "base_branch": "main",
+ "head_branch": "v2.28.0",
+ "additions": 26,
+ "deletions": 7,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 24,
+ "deletions": 5,
+ "changes": 29,
+ "patch": "@@ -6,15 +6,34 @@ dev\n \n - \\[Short description of non-trivial change.\\]\n \n-**Bugfixes**\n \n-- Fixed urllib3 exception leak, wrapping `urllib3.exceptions.SSLError` with\n- `requests.exceptions.SSLError` for `content` and `iter_content`.\n+2.28.0 (2022-06-09)\n+-------------------\n \n **Deprecations**\n \n-- ⚠️ Requests has officially dropped support for Python 2.7. ⚠️\n-- Requests has officially dropped support for Python 3.6 (including pypy3).\n+- ⚠️ Requests has officially dropped support for Python 2.7. ⚠️ (#6091)\n+- Requests has officially dropped support for Python 3.6 (including pypy3.6). (#6091)\n+\n+**Improvements**\n+\n+- [NAME_REDACTED] parsing issues in Request's JSONDecodeError for payloads without\n+ an encoding to make `json()` API consistent. (#6097)\n+- Parse header components consistently, raising an InvalidHeader error in\n+ all invalid cases. (#6154)\n+- Added provisional 3.11 support with current beta build. (#6155)\n+- Requests got a makeover and we decided to paint it black. (#6095)\n+\n+**Bugfixes**\n+\n+- Fixed bug where setting `CURL_CA_BUNDLE` to an empty string would disable\n+ cert verification. All Requests 2.x versions before 2.28.0 are affected. (#6074)\n+- Fixed urllib3 exception leak, wrapping `urllib3.exceptions.SSLError` with\n+ `requests.exceptions.SSLError` for `content` and `iter_content`. (#6057)\n+- Fixed issue where invalid Windows registry entires caused proxy resolution\n+ to raise an exception rather than ignoring the entry. (#6149)\n+- Fixed issue where entire payload could be included in the error message for\n+ JSONDecodeError. (#6036)\n \n 2.27.1 (2022-01-05)\n -------------------"
+ },
+ {
+ "filename": "requests/__version__.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -5,8 +5,8 @@\n __title__ = \"requests\"\n __description__ = \"Python HTTP for Humans.\"\n __url__ = \"https://requests.readthedocs.io\"\n-__version__ = \"2.27.1\"\n-__build__ = 0x022701\n+__version__ = \"2.28.0\"\n+__build__ = 0x022800\n __author__ = \"[NAME_REDACTED]\"\n __author_email__ = \"[EMAIL_REDACTED]\"\n __license__ = \"Apache 2.0\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 1000626864,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "So much awesome in this release!!! :shipit::rocket::sparkles::tada:",
+ "submitted_at": "2022-06-09T01:51:44+00:00"
+ },
+ {
+ "id": 1000643445,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-06-09T02:27:03+00:00"
+ },
+ {
+ "id": 1000643696,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-06-09T02:27:33+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 893001188,
+ "user": "user_b08fb5f52ea1",
+ "body": "Thoughts on moving these to the top under a section \"Breaking Changes\" or \"Removals\"?",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-09T01:51:10+00:00"
+ },
+ {
+ "id": 893001255,
+ "user": "user_b08fb5f52ea1",
+ "body": "Remember to update this if you don't release today.",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-09T01:51:21+00:00"
+ },
+ {
+ "id": 893014397,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yeah, that sounds fine. We've historically had deprecations at the bottom but I'm fine moving them up for visibility.",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-09T02:27:03+00:00"
+ },
+ {
+ "id": 893014600,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yep, I'll move it to tomorrow. No ones getting paged tonight 😁",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-06-09T02:27:33+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "0923dcfc060cf3ae",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.403890+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6091,
+ "title": "Remove support for Python 2.7, 3.6 and Pypy3.6",
+ "body": "This PR is a proposal to officially remove support for Python 2.7 as discussed in #6023. The next minor release (Requests 2.28.0) will no longer provide support for any of the end of life Python runtimes. Users are encouraged to upgrade to Python 3.8 or later. If you're unable to do so, we'd recommend pinning to `requests<2.28`.\n\nThis will be the first of a few PRs that will be doing some general code clean up now that we're moving to a Python 3-only code base. I'll post the others as drafts shortly.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2022-03-23T00:27:13+00:00",
+ "merged_at": "2022-03-25T16:50:34+00:00",
+ "base_branch": "main",
+ "head_branch": "halve_it",
+ "additions": 141,
+ "deletions": 180,
+ "changed_files": 19,
+ "files": [
+ {
+ "filename": ".github/workflows/run-tests.yml",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 5,
+ "changes": 7,
+ "patch": "@@ -9,14 +9,11 @@ jobs:\n strategy:\n fail-fast: false\n matrix:\n- python-version: [\"2.7\", \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\"]\n+ python-version: [\"3.7\", \"3.8\", \"3.9\", \"3.10\"]\n os: [ubuntu-18.04, macOS-latest, windows-latest]\n include:\n- # pypy3 on Mac OS currently fails trying to compile\n+ # pypy-3.7 on Mac OS currently fails trying to compile\n # brotlipy. Moving pypy3 to only test linux.\n- - python-version: pypy3\n- os: ubuntu-latest\n- experimental: false\n - python-version: pypy-3.7\n os: ubuntu-latest\n experimental: false"
+ },
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 0,
+ "changes": 5,
+ "patch": "@@ -11,6 +11,11 @@ dev\n - Fixed urllib3 exception leak, wrapping `urllib3.exceptions.SSLError` with\n `requests.exceptions.SSLError` for `content` and `iter_content`.\n \n+**Deprecations**\n+\n+- ⚠️ Requests has officially dropped support for Python 2.7. ⚠️\n+- Requests has officially dropped support for Python 3.6 (including pypy3).\n+\n 2.27.1 (2022-01-05)\n -------------------"
+ },
+ {
+ "filename": "README.md",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -33,7 +33,7 @@ Requests is available on PyPI:\n $ python -m pip install requests\n ```\n \n-Requests officially supports Python 2.7 & 3.6+.\n+Requests officially supports Python 3.7+.\n \n ## [NAME_REDACTED] & Best–Practices"
+ },
+ {
+ "filename": "docs/community/faq.rst",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 9,
+ "changes": 15,
+ "patch": "@@ -55,16 +55,16 @@ [NAME_REDACTED] gave an excellent summary on\n Python 3 Support?\n -----------------\n \n-Yes! Requests officially supports Python 2.7 & 3.6+ and PyPy.\n+Yes! Requests officially supports Python 3.7+ and PyPy.\n \n Python 2 Support?\n -----------------\n \n-Yes! We understand that we have a large user base with varying needs. Through\n-**at least** Requests 2.27.x, we will be providing continued support for Python\n-2.7. However, this support is likely to end some time in 2022.\n+No! As of Requests 2.28.0, Requests no longer supports Python 2.7. Users who\n+have been unable to migrate should pin to `requests<2.28`. Full information\n+can be found in `psf/requests#6023 `_.\n \n-It is *highly* recommended users migrate to Python 3.7+ now since Python\n+It is *highly* recommended users migrate to Python 3.8+ now since Python\n 2.7 is no longer receiving bug fixes or security updates as of January 1, 2020.\n \n What are \"hostname doesn't match\" errors?\n@@ -83,10 +83,7 @@ when servers are using `[NAME_REDACTED]`_. When such servers are hosting\n more than one SSL site they need to be able to return the appropriate\n certificate based on the hostname the client is connecting to.\n \n-Python3 and Python 2.7.9+ include native support for SNI in their SSL modules.\n-For information on using SNI with Requests on Python < 2.7.9 refer to this\n-`Stack Overflow answer`_.\n+Python 3 already includes native support for SNI in their SSL modules.\n \n .. _`Server-Name-Indication`: https://en.wikipedia.org/wiki/Server_Name_Indication\n .. _`virtual hosting`: https://en.wikipedia.org/wiki/Virtual_hosting\n-.. _`Stack Overflow answer`: https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484"
+ },
+ {
+ "filename": "docs/index.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -72,7 +72,7 @@ Requests is ready for today's web.\n - [NAME_REDACTED]\n - ``.netrc`` Support\n \n-Requests officially supports Python 2.7 & 3.6+, and runs great on PyPy.\n+Requests officially supports Python 3.7+, and runs great on PyPy.\n \n \n The User Guide"
+ },
+ {
+ "filename": "requests/_internal_utils.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 5,
+ "changes": 7,
+ "patch": "@@ -8,7 +8,7 @@\n which depend on extremely few external helpers (such as compat)\n \"\"\"\n \n-from .compat import is_py2, builtin_str, str\n+from .compat import builtin_str\n \n \n def to_native_string(string, encoding='ascii'):\n@@ -19,10 +19,7 @@ def to_native_string(string, encoding='ascii'):\n if isinstance(string, builtin_str):\n out = string\n else:\n- if is_py2:\n- out = string.encode(encoding)\n- else:\n- out = string.decode(encoding)\n+ out = string.decode(encoding)\n \n return out"
+ },
+ {
+ "filename": "requests/adapters.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 6,
+ "changes": 7,
+ "patch": "@@ -477,12 +477,7 @@ def send(self, request, stream=False, timeout=None, verify=True, cert=None, prox\n low_conn.send(b'0\\r\\n\\r\\n')\n \n # Receive the response from the server\n- try:\n- # For Python 2.7, use buffering of HTTP responses\n- r = low_conn.getresponse(buffering=True)\n- except TypeError:\n- # For compatibility with Python 3.3+\n- r = low_conn.getresponse()\n+ r = low_conn.getresponse()\n \n resp = HTTPResponse.from_httplib(\n r,"
+ },
+ {
+ "filename": "requests/compat.py",
+ "status": "modified",
+ "additions": 26,
+ "deletions": 44,
+ "changes": 70,
+ "patch": "@@ -4,8 +4,9 @@\n requests.compat\n ~~~~~~~~~~~~~~~\n \n-This module handles import compatibility issues between Python 2 and\n-Python 3.\n+This module previously handled import compatibility issues\n+between Python 2 and Python 3. It remains for backwards\n+compatibility until the next major version.\n \"\"\"\n \n try:\n@@ -28,54 +29,35 @@\n #: Python 3.x?\n is_py3 = (_ver[0] == 3)\n \n+# json/simplejson module import resolution\n has_simplejson = False\n try:\n import simplejson as json\n has_simplejson = True\n except ImportError:\n import json\n \n+if has_simplejson:\n+ from simplejson import JSONDecodeError\n+else:\n+ from json import JSONDecodeError\n+\n # ---------\n-# Specifics\n+# [NAME_REDACTED]\n # ---------\n-\n-if is_py2:\n- from urllib import (\n- quote, unquote, quote_plus, unquote_plus, urlencode, getproxies,\n- proxy_bypass, proxy_bypass_environment, getproxies_environment)\n- from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag\n- from urllib2 import parse_http_list\n- import cookielib\n- from Cookie import Morsel\n- from StringIO import StringIO\n- # [NAME_REDACTED] for backwards compatibility.\n- from collections import Callable, Mapping, MutableMapping, OrderedDict\n-\n- builtin_str = str\n- bytes = str\n- str = unicode\n- basestring = basestring\n- numeric_types = (int, long, float)\n- integer_types = (int, long)\n- JSONDecodeError = ValueError\n-\n-elif is_py3:\n- from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag\n- from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment\n- from http import cookiejar as cookielib\n- from http.cookies import Morsel\n- from io import StringIO\n- # [NAME_REDACTED] for backwards compatibility.\n- from collections import OrderedDict\n- from collections.abc import Callable, Mapping, MutableMapping\n- if has_simplejson:\n- from simplejson import JSONDecodeError\n- else:\n- from json import JSONDecodeError\n-\n- builtin_str = str\n- str = str\n- bytes = bytes\n- basestring = (str, bytes)\n- numeric_types = (int, float)\n- integer_types = (int,)\n+from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag\n+from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment\n+from http import cookiejar as cookielib\n+from http.cookies import Morsel\n+from io import StringIO\n+\n+# [NAME_REDACTED] for backwards compatibility.\n+from collections import OrderedDict\n+from collections.abc import Callable, Mapping, MutableMapping\n+\n+builtin_str = str\n+str = str\n+bytes = bytes\n+basestring = (str, bytes)\n+numeric_types = (int, float)\n+integer_types = (int,)"
+ },
+ {
+ "filename": "requests/help.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -36,8 +36,8 @@ def _implementation():\n \"\"\"Return a dict with the Python implementation and version.\n \n Provide both the name and the version of the Python implementation\n- currently running. For example, on CPython 2.7.5 it will return\n- {'name': 'CPython', 'version': '2.7.5'}.\n+ currently running. For example, on CPython 3.10.3 it will return\n+ {'name': 'CPython', 'version': '3.10.3'}.\n \n This function works best on CPython and PyPy: in particular, it probably\n doesn't work for Jython or IronPython. Future investigation should be done"
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 20,
+ "changes": 24,
+ "patch": "@@ -8,7 +8,6 @@\n \"\"\"\n \n import datetime\n-import sys\n \n # Import encoding now, to avoid implicit import later.\n # Implicit import within threads may cause LookupError when standard library is in a ZIP,\n@@ -45,8 +44,8 @@\n iter_slices, guess_json_utf, super_len, check_header_validity)\n from .compat import (\n Callable, Mapping,\n- cookielib, urlunparse, urlsplit, urlencode, str, bytes,\n- is_py2, chardet, builtin_str, basestring, JSONDecodeError)\n+ cookielib, urlunparse, urlsplit, urlencode,\n+ chardet, builtin_str, basestring, JSONDecodeError)\n from .compat import json as complexjson\n from .status_codes import codes\n \n@@ -373,7 +372,7 @@ def prepare_url(self, url, params):\n if isinstance(url, bytes):\n url = url.decode('utf8')\n else:\n- url = unicode(url) if is_py2 else str(url)\n+ url = str(url)\n \n # Remove leading whitespaces from url\n url = url.lstrip()\n@@ -424,18 +423,6 @@ def prepare_url(self, url, params):\n if not path:\n path = '/'\n \n- if is_py2:\n- if isinstance(scheme, str):\n- scheme = scheme.encode('utf-8')\n- if isinstance(netloc, str):\n- netloc = netloc.encode('utf-8')\n- if isinstance(path, str):\n- path = path.encode('utf-8')\n- if isinstance(query, str):\n- query = query.encode('utf-8')\n- if isinstance(fragment, str):\n- fragment = fragment.encode('utf-8')\n-\n if isinstance(params, (str, bytes)):\n params = to_native_string(params)\n \n@@ -919,10 +906,7 @@ def json(self, **kwargs):\n except JSONDecodeError as e:\n # Catch JSON-related errors and raise as requests.JSONDecodeError\n # This aliases json.JSONDecodeError and simplejson.JSONDecodeError\n- if is_py2: # e is a ValueError\n- raise RequestsJSONDecodeError(e.message)\n- else:\n- raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)\n+ raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)\n \n [USER_REDACTED]\n def links(self):"
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 7,
+ "changes": 10,
+ "patch": "@@ -14,7 +14,7 @@\n from collections import OrderedDict\n \n from .auth import _basic_auth_str\n-from .compat import cookielib, is_py3, urljoin, urlparse, Mapping\n+from .compat import cookielib, urljoin, urlparse, Mapping\n from .cookies import (\n cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_cookies)\n from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT\n@@ -39,10 +39,7 @@\n \n # Preferred clock, based on which one is more accurate on a given system.\n if sys.platform == 'win32':\n- try: # Python 3.4+\n- preferred_clock = time.perf_counter\n- except AttributeError: # Earlier than Python 3.\n- preferred_clock = time.clock\n+ preferred_clock = time.perf_counter\n else:\n preferred_clock = time.time\n \n@@ -111,8 +108,7 @@ def get_redirect_target(self, resp):\n # It is more likely to get UTF8 header rather than latin1.\n # This causes incorrect handling of UTF8 encoded location headers.\n # To solve this, we re-encode the location in latin1.\n- if is_py3:\n- location = location.encode('latin1')\n+ location = location.encode('latin1')\n return to_native_string(location, 'utf8')\n return None"
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 7,
+ "changes": 10,
+ "patch": "@@ -30,7 +30,7 @@\n from .compat import parse_http_list as _parse_list_header\n from .compat import (\n quote, urlparse, bytes, str, unquote, getproxies,\n- proxy_bypass, urlunparse, basestring, integer_types, is_py3,\n+ proxy_bypass, urlunparse, basestring, integer_types,\n proxy_bypass_environment, getproxies_environment, Mapping)\n from .cookies import cookiejar_from_dict\n from .structures import CaseInsensitiveDict\n@@ -54,10 +54,7 @@\n \n def proxy_bypass_registry(host):\n try:\n- if is_py3:\n- import winreg\n- else:\n- import _winreg as winreg\n+ import winreg\n except ImportError:\n return False\n \n@@ -281,12 +278,11 @@ def extract_zipped_paths(path):\n [USER_REDACTED].contextmanager\n def atomic_open(filename):\n \"\"\"Write a file to the disk in an atomic fashion\"\"\"\n- replacer = os.rename if sys.version_info[0] == 2 else os.replace\n tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename))\n try:\n with os.fdopen(tmp_descriptor, 'wb') as tmp_handler:\n yield tmp_handler\n- replacer(tmp_name, filename)\n+ os.replace(tmp_name, filename)\n except BaseException:\n os.remove(tmp_name)\n raise"
+ },
+ {
+ "filename": "setup.cfg",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 3,
+ "changes": 11,
+ "patch": "@@ -1,5 +1,10 @@\n-[bdist_wheel]\n-universal = 1\n-\n [metadata]\n license_file = LICENSE\n+provides-extra =\n+ socks\n+ use_chardet_on_py3\n+requires-dist =\n+ certifi>=2017.4.17\n+ charset_normalizer~=2.0.0\n+ idna>=2.5,<4\n+ urllib3>=1.21.1,<1.27"
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 30,
+ "deletions": 17,
+ "changes": 47,
+ "patch": "@@ -1,5 +1,4 @@\n #!/usr/bin/env python\n-# Learn more: https://github.com/[USER_REDACTED]nethreitz/setup.py\n import os\n import sys\n \n@@ -8,7 +7,27 @@\n from setuptools import setup\n from setuptools.command.test import test as TestCommand\n \n-here = os.path.abspath(os.path.dirname(__file__))\n+\n+CURRENT_PYTHON = sys.version_info[:2]\n+REQUIRED_PYTHON = (3, 7)\n+\n+if CURRENT_PYTHON < REQUIRED_PYTHON:\n+ sys.stderr.write(\n+ \"\"\"\n+==========================\n+[NAME_REDACTED] version\n+==========================\n+This version of Requests requires at least Python {}.{}, but\n+you're trying to install it on Python {}.{}. To resolve this,\n+consider upgrading to a supported Python version.\n+\n+If you can't upgrade your Python version, you'll need to\n+pin to an older version of Requests (<2.28).\n+\"\"\".format(\n+ *(REQUIRED_PYTHON + CURRENT_PYTHON)\n+ )\n+ )\n+ sys.exit(1)\n \n class PyTest(TestCommand):\n user_options = [('pytest-args=', 'a', \"Arguments to pass into py.test\")]\n@@ -38,27 +57,23 @@ def run_tests(self):\n os.system('twine upload dist/*')\n sys.exit()\n \n-packages = ['requests']\n-\n requires = [\n- 'charset_normalizer~=2.0.0; python_version >= \"3\"',\n- 'chardet>=3.0.2,<5; python_version < \"3\"',\n- 'idna>=2.5,<3; python_version < \"3\"',\n- 'idna>=2.5,<4; python_version >= \"3\"',\n+ 'charset_normalizer~=2.0.0',\n+ 'idna>=2.5,<4',\n 'urllib3>=1.21.1,<1.27',\n- 'certifi>=2017.4.17'\n-\n+ 'certifi>=2017.4.17',\n ]\n test_requirements = [\n 'pytest-httpbin==0.0.7',\n 'pytest-cov',\n 'pytest-mock',\n 'pytest-xdist',\n 'PySocks>=1.5.6, !=1.5.7',\n- 'pytest>=3'\n+ 'pytest>=3',\n ]\n \n about = {}\n+here = os.path.abspath(os.path.dirname(__file__))\n with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:\n exec(f.read(), about)\n \n@@ -74,11 +89,11 @@ def run_tests(self):\n author=about['__author__'],\n author_email=about['__author_email__'],\n url=about['__url__'],\n- packages=packages,\n+ packages=['requests'],\n package_data={'': ['LICENSE', 'NOTICE']},\n package_dir={'requests': 'requests'},\n include_package_data=True,\n- python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*\",\n+ python_requires=\">=3.7, <4\",\n install_requires=requires,\n license=about['__license__'],\n zip_safe=False,\n@@ -90,14 +105,13 @@ def run_tests(self):\n '[NAME_REDACTED] :: English',\n '[NAME_REDACTED] :: OS Independent',\n '[NAME_REDACTED] :: Python',\n- '[NAME_REDACTED] :: Python :: 2',\n- '[NAME_REDACTED] :: Python :: 2.7',\n '[NAME_REDACTED] :: Python :: 3',\n- '[NAME_REDACTED] :: Python :: 3.6',\n '[NAME_REDACTED] :: Python :: 3.7',\n '[NAME_REDACTED] :: Python :: 3.8',\n '[NAME_REDACTED] :: Python :: 3.9',\n '[NAME_REDACTED] :: Python :: 3.10',\n+ '[NAME_REDACTED] :: Python :: 3.11',\n+ '[NAME_REDACTED] :: Python :: 3 :: Only',\n '[NAME_REDACTED] :: Python :: Implementation :: CPython',\n '[NAME_REDACTED] :: Python :: Implementation :: PyPy',\n 'Topic :: Internet :: WWW/HTTP',\n@@ -108,7 +122,6 @@ def run_tests(self):\n extras_require={\n 'security': [],\n 'socks': ['PySocks>=1.5.6, !=1.5.7'],\n- 'socks:sys_platform == \"win32\" and python_version == \"2.7\"': ['win_inet_pton'],\n 'use_chardet_on_py3': ['chardet>=3.0.2,<5']\n },\n project_urls={"
+ },
+ {
+ "filename": "tests/compat.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 9,
+ "changes": 21,
+ "patch": "@@ -1,7 +1,5 @@\n # -*- coding: utf-8 -*-\n-\n-from requests.compat import is_py3\n-\n+import warnings\n \n try:\n import StringIO\n@@ -13,9 +11,14 @@\n except ImportError:\n cStringIO = None\n \n-if is_py3:\n- def u(s):\n- return s\n-else:\n- def u(s):\n- return s.decode('unicode-escape')\n+\n+def u(s):\n+ warnings.warn(\n+ (\n+ \"This helper function is no longer relevant in Python 3. \"\n+ \"Usage of this alias should be discontinued as it will be \"\n+ \"removed in a future release of Requests.\"\n+ ),\n+ DeprecationWarning,\n+ )\n+ return s"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 32,
+ "deletions": 36,
+ "changes": 68,
+ "patch": "@@ -2,7 +2,6 @@\n \n \"\"\"Tests for Requests.\"\"\"\n \n-from __future__ import division\n import json\n import os\n import pickle\n@@ -18,7 +17,7 @@\n from requests.adapters import HTTPAdapter\n from requests.auth import HTTPDigestAuth, _basic_auth_str\n from requests.compat import (\n- Morsel, cookielib, getproxies, str, urlparse,\n+ Morsel, cookielib, getproxies, urlparse,\n builtin_str)\n from requests.cookies import (\n cookiejar_from_dict, morsel_to_cookie)\n@@ -47,9 +46,9 @@\n from requests.sessions import SessionRedirectMixin\n from requests.models import urlencode\n from requests.hooks import default_hooks\n-from requests.compat import JSONDecodeError, is_py3, MutableMapping\n+from requests.compat import JSONDecodeError, MutableMapping\n \n-from .compat import StringIO, u\n+from .compat import StringIO\n from .utils import override_environ\n from urllib3.util import Timeout as Urllib3Timeout\n \n@@ -519,7 +518,7 @@ def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self, httpbin):\n [USER_REDACTED].mark.parametrize(\n 'username, password', (\n ('user', 'pass'),\n- (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8')),\n+ ('имя'.encode('utf-8'), 'пароль'.encode('utf-8')),\n (42, 42),\n (None, None),\n ))\n@@ -843,8 +842,6 @@ def test_conflicting_post_params(self, httpbin):\n with open('requirements-dev.txt') as f:\n with pytest.raises(ValueError):\n requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})\n- with pytest.raises(ValueError):\n- requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})\n \n def test_request_ok_set(self, httpbin):\n r = requests.get(httpbin('status', '404'))\n@@ -989,8 +986,8 @@ def test_different_encodings_dont_break_post(self, httpbin):\n \n [USER_REDACTED].mark.parametrize(\n 'data', (\n- {'stuff': u('ëlïxr')},\n- {'stuff': u('ëlïxr').encode('utf-8')},\n+ {'stuff': 'ëlïxr'},\n+ {'stuff': 'ëlïxr'.encode('utf-8')},\n {'stuff': 'elixr'},\n {'stuff': 'elixr'.encode('utf-8')},\n ))\n@@ -1013,13 +1010,13 @@ def test_unicode_multipart_post_fieldnames(self, httpbin):\n def test_unicode_method_name(self, httpbin):\n files = {'file': open(__file__, 'rb')}\n r = requests.request(\n- method=u('POST'), url=httpbin('post'), files=files)\n+ method='POST', url=httpbin('post'), files=files)\n assert r.status_code == 200\n \n def test_unicode_method_name_with_request_object(self, httpbin):\n files = {'file': open(__file__, 'rb')}\n s = requests.Session()\n- req = requests.Request(u('POST'), httpbin('post'), files=files)\n+ req = requests.Request('POST', httpbin('post'), files=files)\n prep = s.prepare_request(req)\n assert isinstance(prep.method, builtin_str)\n assert prep.method == 'POST'\n@@ -1029,7 +1026,7 @@ def test_unicode_method_name_with_request_object(self, httpbin):\n \n def test_non_prepared_request_error(self):\n s = requests.Session()\n- req = requests.Request(u('POST'), '/')\n+ req = requests.Request('POST', '/')\n \n with pytest.raises(ValueError) as e:\n s.send(req)\n@@ -1336,8 +1333,8 @@ def test_response_decode_unicode(self):\n def test_response_reason_unicode(self):\n # check for unicode HTTP status\n r = requests.Response()\n- r.url = u'unicode URL'\n- r.reason = u'Komponenttia ei löydy'.encode('utf-8')\n+ r.url = 'unicode URL'\n+ r.reason = 'Komponenttia ei löydy'.encode('utf-8')\n r.status_code = 404\n r.encoding = None\n assert not r.ok # old behaviour - crashes here\n@@ -1346,7 +1343,7 @@ def test_response_reason_unicode_fallback(self):\n # check raise_status falls back to ISO-8859-1\n r = requests.Response()\n r.url = 'some url'\n- reason = u'Komponenttia ei löydy'\n+ reason = 'Komponenttia ei löydy'\n r.reason = reason.encode('latin-1')\n r.status_code = 500\n r.encoding = None\n@@ -1593,7 +1590,7 @@ def test_long_authinfo_in_url(self):\n assert r.url == url\n \n def test_header_keys_are_native(self, httpbin):\n- headers = {u('unicode'): 'blah', 'byte'.encode('ascii'): 'blah'}\n+ headers = {'unicode': 'blah', 'byte'.encode('ascii'): 'blah'}\n r = requests.Request('GET', httpbin('get'), headers=headers)\n p = r.prepare()\n \n@@ -1605,7 +1602,7 @@ def test_header_keys_are_native(self, httpbin):\n def test_header_validation(self, httpbin):\n \"\"\"Ensure prepare_headers regex isn't flagging valid header contents.\"\"\"\n headers_ok = {'foo': 'bar baz qux',\n- 'bar': u'fbbq'.encode('utf8'),\n+ 'bar': 'fbbq'.encode('utf8'),\n 'baz': '',\n 'qux': '1'}\n r = requests.get(httpbin('get'), headers=headers_ok)\n@@ -1885,7 +1882,7 @@ def test_redirect_with_wrong_gzipped_header(self, httpbin):\n [USER_REDACTED].mark.parametrize(\n 'username, password, auth_str', (\n ('test', 'test', 'Basic dGVzdDp0ZXN0'),\n- (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8'), 'Basic 0LjQvNGPOtC/0LDRgNC+0LvRjA=='),\n+ ('имя'.encode('utf-8'), 'пароль'.encode('utf-8'), 'Basic 0LjQvNGPOtC/0LDRgNC+0LvRjA=='),\n ))\n def test_basic_auth_str_is_always_native(self, username, password, auth_str):\n s = _basic_auth_str(username, password)\n@@ -2469,7 +2466,7 @@ def test_data_argument_accepts_tuples(data):\n },\n {\n 'method': 'GET',\n- 'url': u('http://www.example.com/üniçø∂é')\n+ 'url': 'http://www.example.com/üniçø∂é'\n },\n ))\n def test_prepared_copy(kwargs):\n@@ -2507,39 +2504,39 @@ class TestPreparingURLs(object):\n 'url,expected',\n (\n ('http://google.com', 'http://google.com/'),\n- (u'http://ジェーピーニック.jp', u'http://xn--hckqz9bzb1cyrb.jp/'),\n- (u'http://xn--n3h.net/', u'http://xn--n3h.net/'),\n+ ('http://ジェーピーニック.jp', 'http://xn--hckqz9bzb1cyrb.jp/'),\n+ ('http://xn--n3h.net/', 'http://xn--n3h.net/'),\n (\n- u'http://ジェーピーニック.jp'.encode('utf-8'),\n- u'http://xn--hckqz9bzb1cyrb.jp/'\n+ 'http://ジェーピーニック.jp'.encode('utf-8'),\n+ 'http://xn--hckqz9bzb1cyrb.jp/'\n ),\n (\n- u'http://straße.de/straße',\n- u'http://xn--strae-oqa.de/stra%C3%9Fe'\n+ 'http://straße.de/straße',\n+ 'http://xn--strae-oqa.de/stra%C3%9Fe'\n ),\n (\n- u'http://straße.de/straße'.encode('utf-8'),\n- u'http://xn--strae-oqa.de/stra%C3%9Fe'\n+ 'http://straße.de/straße'.encode('utf-8'),\n+ 'http://xn--strae-oqa.de/stra%C3%9Fe'\n ),\n (\n- u'http://Königsgäßchen.de/straße',\n- u'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'\n+ 'http://Königsgäßchen.de/straße',\n+ 'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'\n ),\n (\n- u'http://Königsgäßchen.de/straße'.encode('utf-8'),\n- u'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'\n+ 'http://Königsgäßchen.de/straße'.encode('utf-8'),\n+ 'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'\n ),\n (\n b'http://xn--n3h.net/',\n- u'http://xn--n3h.net/'\n+ 'http://xn--n3h.net/'\n ),\n (\n b'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/',\n- u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'\n+ 'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'\n ),\n (\n- u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/',\n- u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'\n+ 'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/',\n+ 'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'\n )\n )\n )\n@@ -2664,7 +2661,6 @@ def test_json_decode_compatibility(self, httpbin):\n assert isinstance(excinfo.value, JSONDecodeError)\n assert r.text not in str(excinfo.value)\n \n- [USER_REDACTED].mark.skipif(not is_py3, reason=\"doc attribute is only present on py3\")\n def test_json_decode_persists_doc_attr(self, httpbin):\n r = requests.get(httpbin('bytes/20'))\n with pytest.raises(requests.exceptions.JSONDecodeError) as excinfo:"
+ },
+ {
+ "filename": "tests/test_utils.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 4,
+ "changes": 5,
+ "patch": "@@ -749,10 +749,7 @@ def test_should_bypass_proxies_win_registry(url, expected, override,\n \"\"\"\n if override is None:\n override = '192.168.*;127.0.0.1;localhost.localdomain;172.16.1.1'\n- if compat.is_py3:\n- import winreg\n- else:\n- import _winreg as winreg\n+ import winreg\n \n class RegHandle:\n def Close(self):"
+ },
+ {
+ "filename": "tests/testserver/server.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 3,
+ "changes": 4,
+ "patch": "@@ -78,9 +78,7 @@ def run(self):\n def _create_socket_and_bind(self):\n sock = socket.socket()\n sock.bind((self.host, self.port))\n- # NB: when Python 2.7 is no longer supported, the argument\n- # can be removed to use a default backlog size\n- sock.listen(5)\n+ sock.listen()\n return sock\n \n def _close_server_sock_ignore_errors(self):"
+ },
+ {
+ "filename": "tox.ini",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,5 +1,5 @@\n [tox]\n-envlist = py{27,36,37,38,39}-{default,use_chardet_on_py3}\n+envlist = py{37,38,39,310}-{default, use_chardet_on_py3}\n \n [testenv]\n deps = -rrequirements-dev.txt"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 918984892,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:32:31+00:00"
+ },
+ {
+ "id": 918988014,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:34:32+00:00"
+ },
+ {
+ "id": 918989347,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": "This is so exciting! Here's a handful of comments/questions:",
+ "submitted_at": "2022-03-23T15:36:26+00:00"
+ },
+ {
+ "id": 919001880,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:41:49+00:00"
+ },
+ {
+ "id": 919004165,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:42:39+00:00"
+ },
+ {
+ "id": 919004456,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:42:44+00:00"
+ },
+ {
+ "id": 919026338,
+ "user": "user_eef3c6ba6f45",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T15:56:05+00:00"
+ },
+ {
+ "id": 919039661,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T16:04:19+00:00"
+ },
+ {
+ "id": 919042580,
+ "user": "user_eef3c6ba6f45",
+ "state": "COMMENTED",
+ "body": "A few other bits to clean up:\n\n`tox.ini`: add `310`, remove `27` and `36`\n\nSeveral files: clean up `use_chardet_on_py3`\n\n`requests/utils.py`: `replacer = os.rename if sys.version_info[0] == 2 else os.replace`\n\n`tests/testserver/server.py`:\n\n```python\n # NB: when Python 2.7 is no longer supported, the argument\n # can be removed to use a default backlog size\n sock.listen(5)\n```",
+ "submitted_at": "2022-03-23T16:07:43+00:00"
+ },
+ {
+ "id": 919046135,
+ "user": "user_eef3c6ba6f45",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-23T16:08:56+00:00"
+ },
+ {
+ "id": 920617581,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T17:20:47+00:00"
+ },
+ {
+ "id": 920630599,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T17:31:20+00:00"
+ },
+ {
+ "id": 920706904,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T18:32:48+00:00"
+ },
+ {
+ "id": 920815330,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T20:03:49+00:00"
+ },
+ {
+ "id": 920838365,
+ "user": "user_1b087c94a628",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T20:18:55+00:00"
+ },
+ {
+ "id": 920839825,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-03-24T20:19:50+00:00"
+ },
+ {
+ "id": 921524787,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "LGTM! :shipit:",
+ "submitted_at": "2022-03-25T11:34:51+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 833410951,
+ "user": "user_b08fb5f52ea1",
+ "body": "Since we're now Python 3.7+ I wonder if we can start using `time.perf_counter` everywhere? Might need to do more research into why Windows was given only perf_counter/clock instead of `time.time()`",
+ "path": "requests/sessions.py",
+ "line": 41,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:32:31+00:00"
+ },
+ {
+ "id": 833413598,
+ "user": "user_b08fb5f52ea1",
+ "body": "[Finally free...](https://pypi.org/project/win-inet-pton) :smiling_face_with_tear:",
+ "path": "setup.py",
+ "line": 111,
+ "side": "LEFT",
+ "created_at": "2022-03-23T15:34:32+00:00"
+ },
+ {
+ "id": 833414757,
+ "user": "user_b08fb5f52ea1",
+ "body": "Should we go through and remove all uses of `u(...)` in the tests to simplify them?",
+ "path": "tests/compat.py",
+ "line": 15,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:35:27+00:00"
+ },
+ {
+ "id": 833415192,
+ "user": "user_b08fb5f52ea1",
+ "body": "Do we need `u'...'`?",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:35:47+00:00"
+ },
+ {
+ "id": 833421896,
+ "user": "user_dbf2a999bd6d",
+ "body": "No we don't, I have a separate linting PR that removes these lines entirely since they're redundant. I can move that into this one.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:41:49+00:00"
+ },
+ {
+ "id": 833422816,
+ "user": "user_dbf2a999bd6d",
+ "body": "I left the definition in case it's in use externally, but yes, it should be removed from all of our tests. I'll do a second pass if I missed some.",
+ "path": "tests/compat.py",
+ "line": 15,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:42:39+00:00"
+ },
+ {
+ "id": 833422938,
+ "user": "user_dbf2a999bd6d",
+ "body": "It was a performance issue for Windows where the clock wasn't granular enough for CI to pass on Appveyor (#3988). I can take a look at standardizing everything onto perf_counter but that's probably a separate deep dive.",
+ "path": "requests/sessions.py",
+ "line": 41,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:42:44+00:00"
+ },
+ {
+ "id": 833439166,
+ "user": "user_eef3c6ba6f45",
+ "body": "`pyupgrade **/*.py --py37-plus` will deal with a bunch of `u''`s and other stuff.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T15:56:05+00:00"
+ },
+ {
+ "id": 833449625,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yep, that's what's in the linting commit currently. Unfortunately, it just makes the two declarations identical so it will still require manual removal in one of the PRs.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T16:04:19+00:00"
+ },
+ {
+ "id": 833451757,
+ "user": "user_eef3c6ba6f45",
+ "body": "```suggestion\n```",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T16:06:26+00:00"
+ },
+ {
+ "id": 833454405,
+ "user": "user_eef3c6ba6f45",
+ "body": "Perhaps add a deprecation warning for any external use?",
+ "path": "tests/compat.py",
+ "line": 15,
+ "side": "RIGHT",
+ "created_at": "2022-03-23T16:08:55+00:00"
+ },
+ {
+ "id": 834551612,
+ "user": "user_b08fb5f52ea1",
+ "body": "We discussed this in the urllib3 Discord with [USER_REDACTED] and [USER_REDACTED] and figured out that this series of steps isn't always going to solve the problem because pip *also* dropped Python versions over time.\n\nThere were a few solutions proposed:\n- Keep the current message\n- Always recommend installing pip<21 (last version that supported Python 2 and 3.5)\n- Recommend installing [pip-with-requires-python](https://pypi.org/project/pip-with-requires-python)\n- Not give a recommendation on *how* to upgrade pip and setuptools?\n\nI also raised the point of recommending users upgrade pip/setuptools would likely break OS installations.",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T17:20:47+00:00"
+ },
+ {
+ "id": 834561046,
+ "user": "user_dbf2a999bd6d",
+ "body": "I think `pip-with-requires-python` is likely the safest option. Alternatively, we'd vend the requires values from the package in our setup.py and compose the install message from those values as [USER_REDACTED] suggested. That avoids any risk for Python 3.4 users who still comprise a significant number of downloads.",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T17:31:20+00:00"
+ },
+ {
+ "id": 834612265,
+ "user": "user_b08fb5f52ea1",
+ "body": "[USER_REDACTED] Noted that new Python versions come with a \"good\" pip version out of the box. Maybe our strategy should be to instruct the user to either pin to <2.28 or upgrade to at least Python 3.7 (since they'll need that version to install Requests anyways) and then we don't need to mention pip/setuptools at all.",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T18:32:48+00:00"
+ },
+ {
+ "id": 834679845,
+ "user": "user_dbf2a999bd6d",
+ "body": "I went ahead and [ripped out the whole of touching pip versions](https://github.com/psf/requests/pull/6091/commits/febcd5199c278d99232124e22b3ab2d912b7cc16) after further discussion. If users want to upgrade their pip, that's something they can manage, otherwise the simplest option is to upgrade their Python version which will provide this automatically.\n\nOther users are free to pin to older supported versions as discussed in the original deprecation announcement.",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T20:03:49+00:00"
+ },
+ {
+ "id": 834692016,
+ "user": "user_1b087c94a628",
+ "body": "```suggestion\npin to an older version of Requests (<2.28).\n```\n\nLet's just go all the way here. :P",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T20:18:55+00:00"
+ },
+ {
+ "id": 834692955,
+ "user": "user_dbf2a999bd6d",
+ "body": "Fair enough :D",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-03-24T20:19:50+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "cfg",
+ "ini",
+ "md",
+ "py",
+ "rst",
+ "yml"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 16,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 17,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 17
+ }
+}
+{
+ "_id": "23d5b79be8cb64d9",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.418732+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 6036,
+ "title": "Limit size of payload in JSONDecodeError",
+ "body": "2.27 introduced a change in behavior where now the exception raised by [NAME_REDACTED] json contains the full body of the invalid response. This gets included it's string representation. This can cause problems when the response is very large. This PR tries to limit the size of the response that we store this way, to what might be around the reported error position. But we could also just return to first n bytes or remove the response altogether and let users fetch it, if needed from the error.response object.",
+ "author": "user_b0902490d1eb",
+ "created_at": "2022-01-07T01:02:24+00:00",
+ "merged_at": "2022-01-13T15:42:49+00:00",
+ "base_branch": "main",
+ "head_branch": "json-err-size",
+ "additions": 23,
+ "deletions": 3,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "requests/exceptions.py",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 0,
+ "changes": 10,
+ "patch": "@@ -34,6 +34,16 @@ class InvalidJSONError(RequestException):\n class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError):\n \"\"\"Couldn't decode the text into json\"\"\"\n \n+ def __init__(self, *args, **kwargs):\n+ \"\"\"\n+ Construct the JSONDecodeError instance first with all\n+ args. Then use it's args to construct the IOError so that\n+ the json specific args aren't used as IOError specific args\n+ and the error message from JSONDecodeError is preserved.\n+ \"\"\"\n+ CompatJSONDecodeError.__init__(self, *args)\n+ InvalidJSONError.__init__(self, *self.args, **kwargs)\n+\n \n class HTTPError(RequestException):\n \"\"\"An HTTP error occurred.\"\"\""
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 13,
+ "deletions": 3,
+ "changes": 16,
+ "patch": "@@ -23,14 +23,14 @@\n cookiejar_from_dict, morsel_to_cookie)\n from requests.exceptions import (\n ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,\n- MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,\n+ MissingSchema, ReadTimeout, Timeout, RetryError, RequestException, TooManyRedirects,\n ProxyError, InvalidHeader, UnrewindableBodyError, SSLError, InvalidProxyURL, InvalidJSONError)\n from requests.models import PreparedRequest\n from requests.structures import CaseInsensitiveDict\n from requests.sessions import SessionRedirectMixin\n from requests.models import urlencode\n from requests.hooks import default_hooks\n-from requests.compat import MutableMapping\n+from requests.compat import JSONDecodeError, is_py3, MutableMapping\n \n from .compat import StringIO, u\n from .utils import override_environ\n@@ -2585,5 +2585,15 @@ def test_post_json_nan(self, httpbin):\n \n def test_json_decode_compatibility(self, httpbin):\n r = requests.get(httpbin('bytes/20'))\n- with pytest.raises(requests.exceptions.JSONDecodeError):\n+ with pytest.raises(requests.exceptions.JSONDecodeError) as excinfo:\n r.json()\n+ assert isinstance(excinfo.value, RequestException)\n+ assert isinstance(excinfo.value, JSONDecodeError)\n+ assert r.text not in str(excinfo.value)\n+\n+ [USER_REDACTED].mark.skipif(not is_py3, reason=\"doc attribute is only present on py3\")\n+ def test_json_decode_persists_doc_attr(self, httpbin):\n+ r = requests.get(httpbin('bytes/20'))\n+ with pytest.raises(requests.exceptions.JSONDecodeError) as excinfo:\n+ r.json()\n+ assert excinfo.value.doc == r.text"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 846975072,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2022-01-07T20:35:47+00:00"
+ },
+ {
+ "id": 847161295,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": "Are there any tests we can add to verify this doesn't revert back to containing the entirety of `doc` in the `__repr__`? It's also unclear how this prevents that from happening on a visual inspection",
+ "submitted_at": "2022-01-08T14:45:02+00:00"
+ },
+ {
+ "id": 848391205,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Left a few small notes but I think we're close to wrapping this up if [USER_REDACTED] doesn't have more concerns.",
+ "submitted_at": "2022-01-10T22:03:27+00:00"
+ },
+ {
+ "id": 848467202,
+ "user": "user_b0902490d1eb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-10T23:41:25+00:00"
+ },
+ {
+ "id": 848469442,
+ "user": "user_b0902490d1eb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-10T23:45:42+00:00"
+ },
+ {
+ "id": 848469866,
+ "user": "user_b0902490d1eb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-10T23:46:37+00:00"
+ },
+ {
+ "id": 848470624,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-10T23:48:06+00:00"
+ },
+ {
+ "id": 848503102,
+ "user": "user_b0902490d1eb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-11T00:58:11+00:00"
+ },
+ {
+ "id": 849413018,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Great, thanks for the updates [USER_REDACTED]! I think there were a couple more things we discussed in the last review I left comments on. Let me know if you have any questions.",
+ "submitted_at": "2022-01-11T16:23:16+00:00"
+ },
+ {
+ "id": 849461725,
+ "user": "user_b0902490d1eb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2022-01-11T16:43:54+00:00"
+ },
+ {
+ "id": 849486491,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Looks good to me, thanks [USER_REDACTED]!",
+ "submitted_at": "2022-01-11T17:03:32+00:00"
+ },
+ {
+ "id": 851870728,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "Seems good to me.",
+ "submitted_at": "2022-01-13T15:29:35+00:00"
+ },
+ {
+ "id": 851874069,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": "I'm still not convinced this is maintainable or correct but I also understand that it's probably a tonne of work to get compatibility on python 2 and 3 that isn't a scary nightmare",
+ "submitted_at": "2022-01-13T15:31:56+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 780674790,
+ "user": "user_0fa58b6f3572",
+ "body": "Can we add comments here explaining why:\n\n1. We're using super old Python 2.5 methods of calling parent `__init__` methods\n2. We're calling the `__init__`s in this particular order - presuming the order matters\n3. This fixes the issue of `.doc` ending up in the message/default `__repr__`",
+ "path": "requests/exceptions.py",
+ "line": 45,
+ "side": "RIGHT",
+ "created_at": "2022-01-08T14:42:14+00:00"
+ },
+ {
+ "id": 780674982,
+ "user": "user_0fa58b6f3572",
+ "body": "Can we add an empty line prior to the `__init__` here? That's already the style of this sub-module if not the entirety of `requests`",
+ "path": "requests/exceptions.py",
+ "line": 37,
+ "side": "RIGHT",
+ "created_at": "2022-01-08T14:44:32+00:00"
+ },
+ {
+ "id": 781581198,
+ "user": "user_dbf2a999bd6d",
+ "body": "nit; This might be phrased \"[...] the error message from JSONDecodeError is preserved.\"\n\nAlso note the missing period in the current sentence.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T21:47:23+00:00"
+ },
+ {
+ "id": 781592203,
+ "user": "user_dbf2a999bd6d",
+ "body": "Do we need to use `.value` in these assertions? Just `excinfo` should be sufficient and that's how the typical user will probably interact with them.",
+ "path": "tests/test_requests.py",
+ "line": 2590,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T21:57:30+00:00"
+ },
+ {
+ "id": 781595242,
+ "user": "user_dbf2a999bd6d",
+ "body": "Also somewhat of a nit. It may be better to just make this its own test with a `[USER_REDACTED].skipIf(not is_py3)` at the top.\n\ne.g.\n\n```python\n[USER_REDACTED].skipIf(not is_py3)\ndef test_json_decode_persists_doc_attr(self, httpbin):\n r = requests.get(httpbin('bytes/20'))\n with pytest.raises(requests.exceptions.JSONDecodeError) as e:\n r.json()\n assert e.doc == r.text\n```",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T22:00:15+00:00"
+ },
+ {
+ "id": 781656546,
+ "user": "user_b0902490d1eb",
+ "body": "don't we want to test that the py2 object is also what we expect? Or if we don't can i can make it py3 only?",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T23:41:24+00:00"
+ },
+ {
+ "id": 781658238,
+ "user": "user_b0902490d1eb",
+ "body": "excinfo is a pytest thing that wraps the actual exception, i think we have to look at value to get the original object",
+ "path": "tests/test_requests.py",
+ "line": 2590,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T23:45:42+00:00"
+ },
+ {
+ "id": 781658559,
+ "user": "user_b0902490d1eb",
+ "body": "updated",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T23:46:37+00:00"
+ },
+ {
+ "id": 781659079,
+ "user": "user_dbf2a999bd6d",
+ "body": "The original test doesn't assert anything about Python 2 either. So we don't lose anything with this change. I suppose we could assert doc _isn't_ on the Python 2 exception but I'm not sure how meaningful that is.\n\nEdit: to be clear I'm proposing two tests. The one you have and moving the Python 3 specifics to its own test.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-10T23:48:06+00:00"
+ },
+ {
+ "id": 781684776,
+ "user": "user_b0902490d1eb",
+ "body": "ok, i think i updated it with what you had in mind.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-11T00:58:10+00:00"
+ },
+ {
+ "id": 782303428,
+ "user": "user_dbf2a999bd6d",
+ "body": "I think the last sentence still needs a period at the end.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-11T16:11:57+00:00"
+ },
+ {
+ "id": 782304038,
+ "user": "user_dbf2a999bd6d",
+ "body": "We probably don't need to reassert this since it's already handled in the test above.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-11T16:12:37+00:00"
+ },
+ {
+ "id": 782312495,
+ "user": "user_dbf2a999bd6d",
+ "body": "nit; since we're only using this once we can probably just use r.text in the final assertion as shown in the original proposal.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-11T16:21:42+00:00"
+ },
+ {
+ "id": 782337397,
+ "user": "user_b0902490d1eb",
+ "body": "I liked having both in the same test, assures us that we are testing with the right string. but i'll take it out.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2022-01-11T16:43:54+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 3,
+ "DISMISSED": 1,
+ "CHANGES_REQUESTED": 2,
+ "COMMENTED": 7
+ },
+ "meaningful_comment_count": 13,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 14
+ }
+}
+{
+ "_id": "9733163dfd7a365e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.424293+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5924,
+ "title": "Refactor rebuild_proxies to separate resolution and auth handling",
+ "body": "This is a proposal for handling #5888 that's come out of discussion in an alternative PR (#5893). Given that we've stalled out on progress there for a few weeks, this PR is to help drive a conclusion. The approach taken here is to mitigate the incorrect behavior of stripping `Proxy-Authorization` headers off all requests sent with `Session.send`. This will not address the performance concerns from #5891 as that's a more significant problem without a clear answer.\n\nThe goal of driving this separately from #5891 is that one is an unintended breakage in basic behavior of the library and the second is an unfortunate performance regression. I'd like to address the former more quickly if possible instead of letting the problem fester.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2021-09-02T06:01:26+00:00",
+ "merged_at": "2021-11-24T19:21:01+00:00",
+ "base_branch": "main",
+ "head_branch": "proxy_auth",
+ "additions": 45,
+ "deletions": 18,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 17,
+ "changes": 24,
+ "patch": "@@ -29,7 +29,7 @@\n \n from .utils import (\n requote_uri, get_environ_proxies, get_netrc_auth, should_bypass_proxies,\n- get_auth_from_url, rewind_body\n+ get_auth_from_url, rewind_body, resolve_proxies\n )\n \n from .status_codes import codes\n@@ -269,7 +269,6 @@ def rebuild_auth(self, prepared_request, response):\n if new_auth is not None:\n prepared_request.prepare_auth(new_auth)\n \n-\n def rebuild_proxies(self, prepared_request, proxies):\n \"\"\"This method re-evaluates the proxy configuration by [NAME_REDACTED] If we are redirected to a URL covered by\n@@ -282,21 +281,9 @@ def rebuild_proxies(self, prepared_request, proxies):\n \n :rtype: dict\n \"\"\"\n- proxies = proxies if proxies is not None else {}\n headers = prepared_request.headers\n- url = prepared_request.url\n- scheme = urlparse(url).scheme\n- new_proxies = proxies.copy()\n- no_proxy = proxies.get('no_proxy')\n-\n- bypass_proxy = should_bypass_proxies(url, no_proxy=no_proxy)\n- if self.trust_env and not bypass_proxy:\n- environ_proxies = get_environ_proxies(url, no_proxy=no_proxy)\n-\n- proxy = environ_proxies.get(scheme, environ_proxies.get('all'))\n-\n- if proxy:\n- new_proxies.setdefault(scheme, proxy)\n+ scheme = urlparse(prepared_request.url).scheme\n+ new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env)\n \n if 'Proxy-Authorization' in headers:\n del headers['Proxy-Authorization']\n@@ -633,7 +620,10 @@ def send(self, request, **kwargs):\n kwargs.setdefault('stream', self.stream)\n kwargs.setdefault('verify', self.verify)\n kwargs.setdefault('cert', self.cert)\n- kwargs.setdefault('proxies', self.rebuild_proxies(request, self.proxies))\n+ if 'proxies' not in kwargs:\n+ kwargs['proxies'] = resolve_proxies(\n+ request, self.proxies, self.trust_env\n+ )\n \n # It's possible that users might accidentally send a Request object.\n # Guard against that specific failure case."
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 28,
+ "deletions": 0,
+ "changes": 28,
+ "patch": "@@ -830,6 +830,34 @@ def select_proxy(url, proxies):\n return proxy\n \n \n+def resolve_proxies(request, proxies, trust_env=True):\n+ \"\"\"This method takes proxy information from a request and configuration\n+ input to resolve a mapping of target proxies. This will consider settings\n+ such a NO_PROXY to strip proxy configurations.\n+\n+ :param request: Request or PreparedRequest\n+ :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs\n+ :param trust_env: Boolean declaring whether to trust environment configs\n+\n+ :rtype: dict\n+ \"\"\"\n+ proxies = proxies if proxies is not None else {}\n+ url = request.url\n+ scheme = urlparse(url).scheme\n+ no_proxy = proxies.get('no_proxy')\n+ new_proxies = proxies.copy()\n+\n+ bypass_proxy = should_bypass_proxies(url, no_proxy=no_proxy)\n+ if trust_env and not bypass_proxy:\n+ environ_proxies = get_environ_proxies(url, no_proxy=no_proxy)\n+\n+ proxy = environ_proxies.get(scheme, environ_proxies.get('all'))\n+\n+ if proxy:\n+ new_proxies.setdefault(scheme, proxy)\n+ return new_proxies\n+\n+\n def default_user_agent(name=\"python-requests\"):\n \"\"\"\n Return a string representing the default user agent."
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 1,
+ "changes": 11,
+ "patch": "@@ -590,6 +590,15 @@ def test_respect_proxy_env_on_request(self, httpbin):\n session = requests.Session()\n session.request(method='GET', url=httpbin())\n \n+ def test_proxy_authorization_preserved_on_request(self, httpbin):\n+ proxy_auth_value = \"Bearer XXX\"\n+ session = requests.Session()\n+ session.headers.update({\"Proxy-Authorization\": proxy_auth_value})\n+ resp = session.request(method='GET', url=httpbin('get'))\n+ sent_headers = resp.json().get('headers', {})\n+\n+ assert sent_headers.get(\"Proxy-Authorization\") == proxy_auth_value\n+\n def test_basicauth_with_netrc(self, httpbin):\n auth = ('user', 'pass')\n wrong_auth = ('wronguser', 'wrongpass')\n@@ -2575,4 +2584,4 @@ def test_post_json_nan(self, httpbin):\n def test_json_decode_compatibility(self, httpbin):\n r = requests.get(httpbin('bytes/20'))\n with pytest.raises(requests.exceptions.JSONDecodeError):\n- r.json()\n\\ No newline at end of file\n+ r.json()"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 745305500,
+ "user": "user_8e4c67791fa1",
+ "state": "COMMENTED",
+ "body": "Hey [USER_REDACTED], thanks for this!\nI added a few comments following up on our discussions.",
+ "submitted_at": "2021-09-02T17:04:31+00:00"
+ },
+ {
+ "id": 745325581,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-09-02T17:13:41+00:00"
+ },
+ {
+ "id": 745326796,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-09-02T17:14:52+00:00"
+ },
+ {
+ "id": 745327920,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-09-02T17:16:02+00:00"
+ },
+ {
+ "id": 746610261,
+ "user": "user_c3e2f6665894",
+ "state": "CHANGES_REQUESTED",
+ "body": "[](https://github.com/psf/requests/pull/5924/files)",
+ "submitted_at": "2021-09-05T03:46:43+00:00"
+ },
+ {
+ "id": 748630378,
+ "user": "user_7d82597c3e08",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-09-08T04:23:38+00:00"
+ },
+ {
+ "id": 748630480,
+ "user": "user_7d82597c3e08",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-09-08T04:23:52+00:00"
+ },
+ {
+ "id": 815299898,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-11-24T19:17:39+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 701262009,
+ "user": "user_8e4c67791fa1",
+ "body": "This change should actually fix the performance regression in most cases (`Session.request` - which I assume is the most common flow - always sets `proxies` on `kwargs`).",
+ "path": "requests/sessions.py",
+ "line": 623,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T16:52:25+00:00"
+ },
+ {
+ "id": 701265200,
+ "user": "user_8e4c67791fa1",
+ "body": "So now we're:\n1. No longer stripping the proxy-auth header. Sounds right to me.\n2. No longer setting the proxy-auth header at all. Is this the desired behavior? What if someone uses a proxy and passes the username + password in the url? (though I'm not sure if that flow is supported or not)",
+ "path": "requests/sessions.py",
+ "line": 624,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T16:56:54+00:00"
+ },
+ {
+ "id": 701266063,
+ "user": "user_8e4c67791fa1",
+ "body": "Didn't we want to unify 850 and 851 so we don't call `should_bypass_proxies` if `trust_env` is `False`?",
+ "path": "requests/utils.py",
+ "line": 850,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T16:58:04+00:00"
+ },
+ {
+ "id": 701276964,
+ "user": "user_dbf2a999bd6d",
+ "body": "For 2.) we were never doing that before this change and I don't think that was an intended byproduct. We should still support our normal proxy auth flows that were available prior to #5681.",
+ "path": "requests/sessions.py",
+ "line": 624,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T17:13:41+00:00"
+ },
+ {
+ "id": 701277868,
+ "user": "user_dbf2a999bd6d",
+ "body": "We do, I was going to have [USER_REDACTED] rebase their change onto whatever we merge so they can still have a commit in the repo.",
+ "path": "requests/utils.py",
+ "line": 850,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T17:14:52+00:00"
+ },
+ {
+ "id": 701278739,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yep, I think `proxies` will be the escape hatch when performance is a concern here :)",
+ "path": "requests/sessions.py",
+ "line": 623,
+ "side": "RIGHT",
+ "created_at": "2021-09-02T17:16:02+00:00"
+ },
+ {
+ "id": 704014493,
+ "user": "user_7d82597c3e08",
+ "body": "Sounds good to me.",
+ "path": "requests/utils.py",
+ "line": 850,
+ "side": "RIGHT",
+ "created_at": "2021-09-08T04:23:38+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 5,
+ "CHANGES_REQUESTED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 7,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 7
+ }
+}
+{
+ "_id": "911de196efb6a478",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.426293+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5917,
+ "title": "Move from urlparse to parse_url for prepending schemes",
+ "body": "This addresses the base problem raised in #5855 with the `urlparse` changes in Python 3.9 and potential issues in future 3.7/3.8 releases. We've avoided changing other uses of `urlparse` for now due to issues with `parse_url`'s strict validation requirements when performing parsing.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2021-08-27T19:10:24+00:00",
+ "merged_at": "2021-12-29T13:31:40+00:00",
+ "base_branch": "main",
+ "head_branch": "proxy_scheme_unknown_fix",
+ "additions": 16,
+ "deletions": 6,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 15,
+ "deletions": 6,
+ "changes": 21,
+ "patch": "@@ -21,6 +21,7 @@\n import zipfile\n from collections import OrderedDict\n from urllib3.util import make_headers\n+from urllib3.util import parse_url\n \n from .__version__ import __version__\n from . import certs\n@@ -963,15 +964,23 @@ def prepend_scheme_if_needed(url, new_scheme):\n \n :rtype: str\n \"\"\"\n- scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)\n-\n- # urlparse is a finicky beast, and sometimes decides that there isn't a\n- # netloc present. Assume that it's being over-cautious, and switch netloc\n- # and path if urlparse decided there was no netloc.\n+ parsed = parse_url(url)\n+ scheme, auth, host, port, path, query, fragment = parsed\n+\n+ # A defect in urlparse determines that there isn't a netloc present in some\n+ # urls. We previously assumed parsing was overly cautious, and swapped the\n+ # netloc and path. Due to a lack of tests on the original defect, this is\n+ # maintained with parse_url for backwards compatibility.\n+ netloc = parsed.netloc\n if not netloc:\n netloc, path = path, netloc\n \n- return urlunparse((scheme, netloc, path, params, query, fragment))\n+ if scheme is None:\n+ scheme = new_scheme\n+ if path is None:\n+ path = ''\n+\n+ return urlunparse((scheme, netloc, path, '', query, fragment))\n \n \n def get_auth_from_url(url):"
+ },
+ {
+ "filename": "tests/test_utils.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -601,6 +601,7 @@ def test_parse_header_links(value, expected):\n 'value, expected', (\n ('example.com/path', 'http://example.com/path'),\n ('//example.com/path', 'http://example.com/path'),\n+ ('example.com:80', 'http://example.com:80'),\n ))\n def test_prepend_scheme_if_needed(value, expected):\n assert prepend_scheme_if_needed(value, 'http') == expected"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 822219138,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-12-03T03:18:15+00:00"
+ },
+ {
+ "id": 824690204,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-12-07T01:46:39+00:00"
+ },
+ {
+ "id": 841177404,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-12-29T04:13:20+00:00"
+ },
+ {
+ "id": 841407199,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-12-29T13:31:34+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 761620552,
+ "user": "user_b08fb5f52ea1",
+ "body": "Uhhh, what? This doesn't make any sense to me, is this something that's only needed for `urlparse`?",
+ "path": "requests/utils.py",
+ "line": 974,
+ "side": "RIGHT",
+ "created_at": "2021-12-03T03:18:15+00:00"
+ },
+ {
+ "id": 763565145,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yeah, this is only a quirk for `urlparse`. I'd thought I repro'd with `parse_url` initially, but I'm unable to now.\n\nI'll reword the whole comment for clarity. I'm not confident the test suite covers all of the initial issue though. I think I'm still in favor of leaving the swap in place as a fallback for anything we're missing.",
+ "path": "requests/utils.py",
+ "line": 974,
+ "side": "RIGHT",
+ "created_at": "2021-12-07T01:46:39+00:00"
+ },
+ {
+ "id": 776146587,
+ "user": "user_dbf2a999bd6d",
+ "body": "[USER_REDACTED] I've reworded things to be a bit clearer.",
+ "path": "requests/utils.py",
+ "line": 974,
+ "side": "RIGHT",
+ "created_at": "2021-12-29T04:13:20+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "152a7d907f1549be",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.427292+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5909,
+ "title": "Add thread locker workflow",
+ "body": null,
+ "author": "user_0fa58b6f3572",
+ "created_at": "2021-08-25T00:23:19+00:00",
+ "merged_at": "2021-08-25T18:21:36+00:00",
+ "base_branch": "main",
+ "head_branch": "lock-threads",
+ "additions": 15,
+ "deletions": 0,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": ".github/workflows/lock-issues.yml",
+ "status": "added",
+ "additions": 15,
+ "deletions": 0,
+ "changes": 15,
+ "patch": "@@ -0,0 +1,15 @@\n+name: '[NAME_REDACTED]'\n+\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+permissions:\n+ issues: write\n+ pull-requests: write\n+\n+jobs:\n+ action:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v2"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 737824574,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Just a minor fix needed and then I think this looks good. Thanks, [USER_REDACTED]!",
+ "submitted_at": "2021-08-25T01:49:19+00:00"
+ },
+ {
+ "id": 737827383,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-08-25T01:55:27+00:00"
+ },
+ {
+ "id": 738521818,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "🚀",
+ "submitted_at": "2021-08-25T15:40:31+00:00"
+ },
+ {
+ "id": 738694200,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-08-25T18:24:30+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 695330209,
+ "user": "user_dbf2a999bd6d",
+ "body": "It looks like this got clipped during copy. `me`->`name`",
+ "path": ".github/workflows/lock-issues.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-08-25T01:48:29+00:00"
+ },
+ {
+ "id": 695332737,
+ "user": "user_dbf2a999bd6d",
+ "body": "Actually one more thought while we're here. It looks like some other projects have [shortened the window](https://github.com/pyca/pyopenssl/blob/main/.github/workflows/lock.yml#L13-L14) from 365 days to 90. That may be more reasonable to prevent unrelated pings resetting such a long timer.",
+ "path": ".github/workflows/lock-issues.yml",
+ "line": 15,
+ "side": "RIGHT",
+ "created_at": "2021-08-25T01:55:27+00:00"
+ },
+ {
+ "id": 696008774,
+ "user": "user_0fa58b6f3572",
+ "body": "Oh, I missed this. Hold on. #5911",
+ "path": ".github/workflows/lock-issues.yml",
+ "line": 15,
+ "side": "RIGHT",
+ "created_at": "2021-08-25T18:24:30+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 2,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "61e193af1c56f5a7",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.434626+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5856,
+ "title": "Fix inconsistent exception type in response.json() method",
+ "body": "## Summary\nFixes the inconsistency of errors thrown in the `response.json()` method in `models.py`, while preserving backwards compatibility. \n\n### What we used to have\nDepending on whether or not `simplejson` was installed in the user's library, and whether the user was running Python 3+ versus Python 2, a different exception would get thrown when there was an issue with decoding response text as JSON. If `simplejson` was installed, `simplejson.JSONDecodeError` would get thrown. If not, `json.JSONDecodeError` would get thrown for Python 3+ users, and `ValueError` for Python 2 users. Thus, depending on the scenario, users would find themselves having to catch either `simplejson.JSONDecodeError`, `json.JSONDecodeError`, or `ValueError` in the case of the `response.json()` method failing. This inconsistency is not ideal.\n\n### What we have now\nThere is now one error class in `exceptions.py` that will represent all errors that can be thrown or caught in the `response.json()` method: `requests.JSONDecodeError`. All `simplejson` functionality was replaced with `json` functionality, but the new error type aliases both `json.JSONDecodeError` and `simplejson.JSONDecodeError`. If `simplejson` is not installed, its `JSONDecodError` is replaced with a plain `Exception` when aliased. If the user is running Python 3+, `json.JSONDecodeError` is aliased, but if the user is running Python 2, that is replaced with `ValueError` when aliased, as the `JSONDecodeError` was not previously a part of the `json` library. Now, all five error types, `json.JSONDecodeError`, `simplejson.JSONDecodeError`, `ValueError`, and `requests.JSONDecodeError` and its parent class `requests.RequestException`, will be caught from the `requests.JSONDecodeError` that will be raised.\n\nFixes #5794\n[USER_REDACTED]",
+ "author": "user_a7b578c0e355",
+ "created_at": "2021-07-03T21:08:32+00:00",
+ "merged_at": "2021-07-26T15:56:44+00:00",
+ "base_branch": "master",
+ "head_branch": "json-opt-2",
+ "additions": 47,
+ "deletions": 18,
+ "changed_files": 7,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -4,7 +4,12 @@ Release History\n dev\n ---\n \n-- \\[Short description of non-trivial change.\\]\n+- \\[Short description of non-trivial change.\\]\n+\n+- Added a `requests.exceptions.JSONDecodeError` to decrease inconsistencies\n+ in the library. This gets raised in the `response.json()` method, and is\n+ backwards compatible as it inherits from previously thrown exceptions.\n+ Can be caught from `requests.exceptions.RequestException` as well.\n \n 2.26.0 (2021-07-13)\n -------------------"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -153,9 +153,9 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data::\n \n In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if\n the response gets a 204 ([NAME_REDACTED]), or if the response contains invalid JSON,\n-attempting ``r.json()`` raises ``simplejson.JSONDecodeError`` if simplejson is\n-installed or raises ``ValueError: No JSON object could be decoded`` on Python 2 or\n-``json.JSONDecodeError`` on Python 3.\n+attempting ``r.json()`` raises ``requests.exceptions.JSONDecodeError``. This wrapper exception\n+provides interoperability for multiple exceptions that may be thrown by different\n+python versions and json serialization libraries.\n \n It should be noted that the success of the call to ``r.json()`` does **not**\n indicate the success of the response. Some servers may return a JSON object in a"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -139,7 +139,7 @@ def _check_cryptography(cryptography_version):\n from .exceptions import (\n RequestException, Timeout, URLRequired,\n TooManyRedirects, HTTPError, ConnectionError,\n- FileModeWarning, ConnectTimeout, ReadTimeout\n+ FileModeWarning, ConnectTimeout, ReadTimeout, JSONDecodeError\n )\n \n # Set default logging handler to avoid \"No handler found\" warnings."
+ },
+ {
+ "filename": "requests/compat.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 1,
+ "changes": 8,
+ "patch": "@@ -28,8 +28,10 @@\n #: Python 3.x?\n is_py3 = (_ver[0] == 3)\n \n+has_simplejson = False\n try:\n import simplejson as json\n+ has_simplejson = True\n except ImportError:\n import json\n \n@@ -49,13 +51,13 @@\n # [NAME_REDACTED] for backwards compatibility.\n from collections import Callable, Mapping, MutableMapping, OrderedDict\n \n-\n builtin_str = str\n bytes = str\n str = unicode\n basestring = basestring\n numeric_types = (int, long, float)\n integer_types = (int, long)\n+ JSONDecodeError = ValueError\n \n elif is_py3:\n from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag\n@@ -66,6 +68,10 @@\n # [NAME_REDACTED] for backwards compatibility.\n from collections import OrderedDict\n from collections.abc import Callable, Mapping, MutableMapping\n+ if has_simplejson:\n+ from simplejson import JSONDecodeError\n+ else:\n+ from json import JSONDecodeError\n \n builtin_str = str\n str = str"
+ },
+ {
+ "filename": "requests/exceptions.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -8,6 +8,8 @@\n \"\"\"\n from urllib3.exceptions import HTTPError as BaseHTTPError\n \n+from .compat import JSONDecodeError as CompatJSONDecodeError\n+\n \n class RequestException(IOError):\n \"\"\"There was an ambiguous exception that occurred while handling your\n@@ -29,6 +31,10 @@ class InvalidJSONError(RequestException):\n \"\"\"A JSON error occurred.\"\"\"\n \n \n+class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError):\n+ \"\"\"Couldn't decode the text into json\"\"\"\n+\n+\n class HTTPError(RequestException):\n \"\"\"An HTTP error occurred.\"\"\""
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 11,
+ "changes": 29,
+ "patch": "@@ -29,7 +29,9 @@\n from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar\n from .exceptions import (\n HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,\n- ContentDecodingError, ConnectionError, StreamConsumedError, InvalidJSONError)\n+ ContentDecodingError, ConnectionError, StreamConsumedError,\n+ InvalidJSONError)\n+from .exceptions import JSONDecodeError as RequestsJSONDecodeError\n from ._internal_utils import to_native_string, unicode_is_ascii\n from .utils import (\n guess_filename, get_auth_from_url, requote_uri,\n@@ -38,7 +40,7 @@\n from .compat import (\n Callable, Mapping,\n cookielib, urlunparse, urlsplit, urlencode, str, bytes,\n- is_py2, chardet, builtin_str, basestring)\n+ is_py2, chardet, builtin_str, basestring, JSONDecodeError)\n from .compat import json as complexjson\n from .status_codes import codes\n \n@@ -468,9 +470,9 @@ def prepare_body(self, data, files, json=None):\n content_type = 'application/json'\n \n try:\n- body = complexjson.dumps(json, allow_nan=False)\n+ body = complexjson.dumps(json, allow_nan=False)\n except ValueError as ve:\n- raise InvalidJSONError(ve, request=self)\n+ raise InvalidJSONError(ve, request=self)\n \n if not isinstance(body, bytes):\n body = body.encode('utf-8')\n@@ -882,12 +884,8 @@ def json(self, **kwargs):\n r\"\"\"Returns the json-encoded content of a response, if any.\n \n :param \\*\\*kwargs: Optional arguments that ``json.loads`` takes.\n- :raises simplejson.JSONDecodeError: If the response body does not\n- contain valid json and simplejson is installed.\n- :raises json.JSONDecodeError: If the response body does not contain\n- valid json and simplejson is not installed on Python 3.\n- :raises ValueError: If the response body does not contain valid\n- json and simplejson is not installed on Python 2. \n+ :raises requests.exceptions.JSONDecodeError: If the response body does not\n+ contain valid json.\n \"\"\"\n \n if not self.encoding and self.content and len(self.content) > 3:\n@@ -907,7 +905,16 @@ def json(self, **kwargs):\n # and the server didn't bother to tell us what codec *was*\n # used.\n pass\n- return complexjson.loads(self.text, **kwargs)\n+\n+ try:\n+ return complexjson.loads(self.text, **kwargs)\n+ except JSONDecodeError as e:\n+ # Catch JSON-related errors and raise as requests.JSONDecodeError\n+ # This aliases json.JSONDecodeError and simplejson.JSONDecodeError\n+ if is_py2: # e is a ValueError\n+ raise RequestsJSONDecodeError(e.message)\n+ else:\n+ raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)\n \n [USER_REDACTED]\n def links(self):"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -2570,4 +2570,9 @@ def test_parameters_for_nonstandard_schemes(self, input, params, expected):\n def test_post_json_nan(self, httpbin):\n data = {\"foo\": float(\"nan\")}\n with pytest.raises(requests.exceptions.InvalidJSONError):\n- r = requests.post(httpbin('post'), json=data)\n\\ No newline at end of file\n+ r = requests.post(httpbin('post'), json=data)\n+\n+ def test_json_decode_compatibility(self, httpbin):\n+ r = requests.get(httpbin('bytes/20'))\n+ with pytest.raises(requests.exceptions.JSONDecodeError):\n+ r.json()\n\\ No newline at end of file"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 699315720,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:19:59+00:00"
+ },
+ {
+ "id": 699316144,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:20:44+00:00"
+ },
+ {
+ "id": 699316298,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:21:02+00:00"
+ },
+ {
+ "id": 699316479,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:21:22+00:00"
+ },
+ {
+ "id": 699316559,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:21:31+00:00"
+ },
+ {
+ "id": 699316628,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:21:38+00:00"
+ },
+ {
+ "id": 699316758,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:21:53+00:00"
+ },
+ {
+ "id": 699316823,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:22:00+00:00"
+ },
+ {
+ "id": 699316875,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:22:07+00:00"
+ },
+ {
+ "id": 699317046,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:22:29+00:00"
+ },
+ {
+ "id": 699317076,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:22:33+00:00"
+ },
+ {
+ "id": 699317173,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:22:44+00:00"
+ },
+ {
+ "id": 699317498,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:23:21+00:00"
+ },
+ {
+ "id": 699318082,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:24:32+00:00"
+ },
+ {
+ "id": 699318141,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:24:39+00:00"
+ },
+ {
+ "id": 699318192,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:24:44+00:00"
+ },
+ {
+ "id": 699318680,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:25:43+00:00"
+ },
+ {
+ "id": 699320121,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:28:31+00:00"
+ },
+ {
+ "id": 699322273,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:32:45+00:00"
+ },
+ {
+ "id": 699327859,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T16:44:57+00:00"
+ },
+ {
+ "id": 700469010,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-07T00:02:39+00:00"
+ },
+ {
+ "id": 700469936,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-07T00:05:18+00:00"
+ },
+ {
+ "id": 703242572,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2021-07-09T17:25:28+00:00"
+ },
+ {
+ "id": 703257872,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-09T17:26:43+00:00"
+ },
+ {
+ "id": 703278537,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-09T17:56:48+00:00"
+ },
+ {
+ "id": 704227741,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-12T15:07:16+00:00"
+ },
+ {
+ "id": 705748435,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-14T00:25:16+00:00"
+ },
+ {
+ "id": 706822735,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2021-07-15T00:31:01+00:00"
+ },
+ {
+ "id": 708264387,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-16T11:18:20+00:00"
+ },
+ {
+ "id": 706441683,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": "Thanks for the updates, [USER_REDACTED]. I added a couple of comments for discussion. I'm not convinced they're necessarily the right direction, but it does feel like the simplejson/json problems are potentially being spread more places than needed.\n\nLet me know what you think, thanks!",
+ "submitted_at": "2021-07-16T18:22:12+00:00"
+ },
+ {
+ "id": 710735484,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-20T15:40:55+00:00"
+ },
+ {
+ "id": 710910737,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-20T17:53:18+00:00"
+ },
+ {
+ "id": 710943013,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-20T18:30:36+00:00"
+ },
+ {
+ "id": 713331292,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-23T00:36:29+00:00"
+ },
+ {
+ "id": 713360941,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-23T02:30:46+00:00"
+ },
+ {
+ "id": 713744325,
+ "user": "user_a7b578c0e355",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-23T13:47:08+00:00"
+ },
+ {
+ "id": 714234668,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-24T13:31:10+00:00"
+ },
+ {
+ "id": 714254560,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Cool, I think this looks like we’re ready now. Thanks for seeing this through, [USER_REDACTED].\n\nFor merging, I’m not sure if we want to put this on a 2.27.x branch while we wait for the next release, or if we merge now knowing we won’t do another patch release for 2.26.x. Any thoughts [USER_REDACTED]?",
+ "submitted_at": "2021-07-24T19:05:56+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 664037480,
+ "user": "user_0fa58b6f3572",
+ "body": "This is backwards incompatible and needs to be reverted",
+ "path": "requests/compat.py",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2021-07-05T16:19:59+00:00"
+ },
+ {
+ "id": 664037858,
+ "user": "user_0fa58b6f3572",
+ "body": "I forgot we had this exception, where do we use it? Should we sub-class this in `JSONDecodeError` as well?",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:20:44+00:00"
+ },
+ {
+ "id": 664037984,
+ "user": "user_0fa58b6f3572",
+ "body": "Why did you change this?",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:21:01+00:00"
+ },
+ {
+ "id": 664038143,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this. It's tangential to the change",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:21:22+00:00"
+ },
+ {
+ "id": 664038217,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this as well",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:21:31+00:00"
+ },
+ {
+ "id": 664038264,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:21:38+00:00"
+ },
+ {
+ "id": 664038389,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:21:52+00:00"
+ },
+ {
+ "id": 664038455,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:22:00+00:00"
+ },
+ {
+ "id": 664038511,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:22:07+00:00"
+ },
+ {
+ "id": 664038661,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:22:28+00:00"
+ },
+ {
+ "id": 664038684,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:22:33+00:00"
+ },
+ {
+ "id": 664038757,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:22:44+00:00"
+ },
+ {
+ "id": 664039064,
+ "user": "user_0fa58b6f3572",
+ "body": "Please document this as `requests.exceptions.JSONDecodeError`. Eventually I desperately want to stop importing every exception class into `requests/__init__.py`",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:23:21+00:00"
+ },
+ {
+ "id": 664039537,
+ "user": "user_0fa58b6f3572",
+ "body": "We should probably preserve the original exception instance in this as well and proxy attributes down to it. That way folks can find the original exception. I'm not certain `simplejson` and `json` have the same exception attributes with the same meaning",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:24:32+00:00"
+ },
+ {
+ "id": 664039589,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:24:39+00:00"
+ },
+ {
+ "id": 664039631,
+ "user": "user_0fa58b6f3572",
+ "body": "Please revert this",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:24:44+00:00"
+ },
+ {
+ "id": 664040057,
+ "user": "user_0fa58b6f3572",
+ "body": "We must be clear that this is _new_ in the next version of Requests (add it to our changelog too) and that it is backwards compatible as it inherits from the exceptions raised previously",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:25:43+00:00"
+ },
+ {
+ "id": 664041283,
+ "user": "user_a7b578c0e355",
+ "body": "Do you want me to add it to the changelog now or do you like to do that?",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:28:30+00:00"
+ },
+ {
+ "id": 664043187,
+ "user": "user_a7b578c0e355",
+ "body": "I added this exception to sub-class both `JSONDecodeError`s",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:32:45+00:00"
+ },
+ {
+ "id": 664047954,
+ "user": "user_0fa58b6f3572",
+ "body": "Please add it to the changelog now",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T16:44:57+00:00"
+ },
+ {
+ "id": 664949709,
+ "user": "user_0fa58b6f3572",
+ "body": "I'm talking about the `InvalidJSONError` exception here (the line I commented on)",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-07T00:02:39+00:00"
+ },
+ {
+ "id": 667093966,
+ "user": "user_dbf2a999bd6d",
+ "body": "We probably don't want to add all the information in the last sentence as it will become stale quickly. Let's simplfy it to something closer to:\n\n> This wrapper exception provides interoperability for multiple exceptions that may be thrown by [NAME_REDACTED] json serialization libraries.",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:04:51+00:00"
+ },
+ {
+ "id": 667094313,
+ "user": "user_dbf2a999bd6d",
+ "body": "These spacing changes aren't really related to the current PR, can we remove them.",
+ "path": "requests/compat.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:05:30+00:00"
+ },
+ {
+ "id": 667095839,
+ "user": "user_dbf2a999bd6d",
+ "body": "Our custom exceptions in Requests should ideally fall under a catch-all parent exception, `RequestException`. That allows users to catch everything thrown by Requests.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:08:32+00:00"
+ },
+ {
+ "id": 667096117,
+ "user": "user_dbf2a999bd6d",
+ "body": "I think we're still waiting on a response here, [USER_REDACTED].",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:09:04+00:00"
+ },
+ {
+ "id": 667104578,
+ "user": "user_dbf2a999bd6d",
+ "body": "I'm not sure I'm following how this will work in the Python 2 `json` case. Where is `ValueError` being handled?",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:24:48+00:00"
+ },
+ {
+ "id": 667105634,
+ "user": "user_dbf2a999bd6d",
+ "body": "https://github.com/psf/requests/pull/5856/checks?check_run_id=3031103164 Yeah, this is broken. We need to be able to handle this a different way.",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:26:43+00:00"
+ },
+ {
+ "id": 667121799,
+ "user": "user_dbf2a999bd6d",
+ "body": "I see your last comment was made outside of this thread, [USER_REDACTED]. To clarify, while `json.JSONDecodeError` does inherit from `ValueError`, it's not going to work in this case. The exception doesn't exist in Python 2, so we fall over with an attribute error when handling the exception. You'll need to take another approach to handle this.",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-09T17:56:48+00:00"
+ },
+ {
+ "id": 668015646,
+ "user": "user_a7b578c0e355",
+ "body": "Yes, I can subclass that in `JSONDecodeError` as well.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-12T15:07:16+00:00"
+ },
+ {
+ "id": 669195075,
+ "user": "user_0fa58b6f3572",
+ "body": "Giving the user 0 useful information is unacceptable. Why can't we use `e.message` there?\n\n```py\nPython 2.7.18 (default, May 19 2021, 00:00:00)\n[GCC 11.1.1 20210428 ([NAME_REDACTED] 11.1.1-1)] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import json\n>>> try:\n... json.loads(\"foo\")\n... except ValueError as ve:\n... pass\n...\n>>> dir(ve)\n['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', 'args', 'message']\n>>> ve.message\n'No JSON object could be decoded'\n>>> ve.args\n('No JSON object could be decoded',)\n>>>\n```",
+ "path": "requests/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-14T00:25:15+00:00"
+ },
+ {
+ "id": 669741494,
+ "user": "user_dbf2a999bd6d",
+ "body": "It doesn't look like we use this anywhere except to declare the exceptions. We're already setting either dependency to be imported under the `json` namespace. Can we not just do `from json import JSONDecodeError` under the py3 section and have it automatically resolve? Perhaps adding a short comment above the import saying it's using simplejson or json depending on what was resolved?",
+ "path": "requests/compat.py",
+ "line": 31,
+ "side": "RIGHT",
+ "created_at": "2021-07-14T15:49:47+00:00"
+ },
+ {
+ "id": 670040646,
+ "user": "user_0fa58b6f3572",
+ "body": "Why did you remove this?",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "LEFT",
+ "created_at": "2021-07-15T00:29:52+00:00"
+ },
+ {
+ "id": 670040807,
+ "user": "user_0fa58b6f3572",
+ "body": "2.26.0 was released. This can not be added to those notes as this was not released with 2.26.0 please move it above the `2.26.0 (2021-07-13)` line.",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-15T00:30:22+00:00"
+ },
+ {
+ "id": 670040920,
+ "user": "user_0fa58b6f3572",
+ "body": "These changes in this file are unrelated and should be in a separate PR",
+ "path": "docs/api.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-15T00:30:45+00:00"
+ },
+ {
+ "id": 671444604,
+ "user": "user_dbf2a999bd6d",
+ "body": "We have logic for which simplejson/json exceptions we're using spread across a few places now. Is there a compelling reason not to simply import JSONDecodeError from compat since it's already been resolved and supplying it as a single parent class?",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-16T18:18:17+00:00"
+ },
+ {
+ "id": 673240914,
+ "user": "user_a7b578c0e355",
+ "body": "[USER_REDACTED] We want to know which properties the `JSONDecodeError` has, since it may have different properties depending on compatibility. That requires an extra check on import.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-20T15:40:55+00:00"
+ },
+ {
+ "id": 673356731,
+ "user": "user_dbf2a999bd6d",
+ "body": "[USER_REDACTED] I'm not sure I'm following, could you clarify which properties you're referring to? We have 3 parent classes that we'd ever use in our environment, `json.JSONDecodeError`, `simplejson.JSONDecodeError`, and `ValueError`. Only one of those can be relevant in a given execution of Requests.\n\nWhat I was asking about was if we did:\n\n```python\nfrom .compat import JSONDecodeError as CompatJSONDecodeError\n\n[...]\n\nclass JSONDecodeError(InvalidJSONError, CompatJSONDecodeError):\n```\n\nWe've already resolved these values once in compat, so I wanted to know why we're doing it again here.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-20T17:53:17+00:00"
+ },
+ {
+ "id": 673381345,
+ "user": "user_a7b578c0e355",
+ "body": "[USER_REDACTED] For Python 3, in the `compat.py` file itself, reference to the `json` package directly, whether aliased as `json` or actually the `json` package itself, would always look for the `json` package rather than whatever was aliased as it. So, just in the `compat.py` file itself, I used the check. From all other scripts that have `from .compat import json`, however, it works as expected.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-20T18:30:36+00:00"
+ },
+ {
+ "id": 675244754,
+ "user": "user_a7b578c0e355",
+ "body": "Did you have any more questions about the code?",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-23T00:36:28+00:00"
+ },
+ {
+ "id": 675272659,
+ "user": "user_dbf2a999bd6d",
+ "body": "Hey [USER_REDACTED], I think there may still be some confusion. If you open the _Files changed_ tab, you should be able to see the full context of this thread. I've written out the [full diff](https://github.com/nateprewitt/requests/commit/665cf30861fb356d84103808e240d6940e8ff3d6) from the suggestion above to minimize ambiguity. You should find this passes the test suite without issue, so please let me know if there were other concerns you had.\n\nWhile we're here it would also be good to add a test exercising this change. Something to the effect of the example below should be sufficient:\n\n```\ndef test_json_decode_compatibility(self, httpbin):\n r = requests.get(httpbin('bytes/20'))\n with pytest.raises(requests.exceptions.JSONDecodeError):\n r.json()\n```\n\nThis won't cover simplejson in our general test suite, but I've done a one off run to ensure that's working.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-23T02:30:46+00:00"
+ },
+ {
+ "id": 675577985,
+ "user": "user_a7b578c0e355",
+ "body": "Thank you, that makes total sense. I made those changes and I'm running workflows right now.",
+ "path": "requests/exceptions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-23T13:47:07+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py",
+ "rst"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 32,
+ "APPROVED": 4,
+ "CHANGES_REQUESTED": 2
+ },
+ "meaningful_comment_count": 41,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 41
+ }
+}
+{
+ "_id": "5cc48cdb15c7f0f0",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.434626+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5810,
+ "title": "Throw value error when serializing JSON object with NaN value",
+ "body": "I am attempting to fix #5767 with this PR. Feedback is really appreciated.",
+ "author": "user_a39686a32f90",
+ "created_at": "2021-05-04T10:37:03+00:00",
+ "merged_at": "2021-05-06T18:18:58+00:00",
+ "base_branch": "master",
+ "head_branch": "nan-json-serialize",
+ "additions": 17,
+ "deletions": 3,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "requests/exceptions.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -25,6 +25,10 @@ def __init__(self, *args, **kwargs):\n super(RequestException, self).__init__(*args, **kwargs)\n \n \n+class InvalidJSONError(RequestException):\n+ \"\"\"A JSON error occurred.\"\"\"\n+\n+\n class HTTPError(RequestException):\n \"\"\"An HTTP error occurred.\"\"\""
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 2,
+ "changes": 9,
+ "patch": "@@ -29,7 +29,7 @@\n from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar\n from .exceptions import (\n HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,\n- ContentDecodingError, ConnectionError, StreamConsumedError)\n+ ContentDecodingError, ConnectionError, StreamConsumedError, InvalidJSONError)\n from ._internal_utils import to_native_string, unicode_is_ascii\n from .utils import (\n guess_filename, get_auth_from_url, requote_uri,\n@@ -466,7 +466,12 @@ def prepare_body(self, data, files, json=None):\n # urllib3 requires a bytes-like body. Python 2's json.dumps\n # provides this natively, but Python 3 gives a Unicode string.\n content_type = 'application/json'\n- body = complexjson.dumps(json)\n+\n+ try:\n+ body = complexjson.dumps(json, allow_nan=False)\n+ except ValueError as ve:\n+ raise InvalidJSONError(ve, request=self)\n+\n if not isinstance(body, bytes):\n body = body.encode('utf-8')"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -24,7 +24,7 @@\n from requests.exceptions import (\n ConnectionError, ConnectTimeout, InvalidSchema, InvalidURL,\n MissingSchema, ReadTimeout, Timeout, RetryError, TooManyRedirects,\n- ProxyError, InvalidHeader, UnrewindableBodyError, SSLError, InvalidProxyURL)\n+ ProxyError, InvalidHeader, UnrewindableBodyError, SSLError, InvalidProxyURL, InvalidJSONError)\n from requests.models import PreparedRequest\n from requests.structures import CaseInsensitiveDict\n from requests.sessions import SessionRedirectMixin\n@@ -2566,3 +2566,8 @@ def test_parameters_for_nonstandard_schemes(self, input, params, expected):\n r = requests.Request('GET', url=input, params=params)\n p = r.prepare()\n assert p.url == expected\n+\n+ def test_post_json_nan(self, httpbin):\n+ data = {\"foo\": float(\"nan\")}\n+ with pytest.raises(requests.exceptions.InvalidJSONError):\n+ r = requests.post(httpbin('post'), json=data)\n\\ No newline at end of file"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 651217570,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": "I don't believe a `request()` method will throw a ValueError ever and so this constitutes a backwards incompatible change. We should create a new exception, however, that inherits from `RequestsException` to cover this case and do something like\n\n```py\ntry:\n body = complexjson.dumps(json, allow_nan=False)\nexcept ValueError as ve:\n raise InvalidJSONError(json, original_exc=ve)\n```",
+ "submitted_at": "2021-05-04T13:11:16+00:00"
+ },
+ {
+ "id": 651301885,
+ "user": "user_a39686a32f90",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-04T14:26:23+00:00"
+ },
+ {
+ "id": 653755925,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-06T18:14:57+00:00"
+ },
+ {
+ "id": 653759134,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-05-06T18:18:52+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 625828753,
+ "user": "user_a39686a32f90",
+ "body": "[USER_REDACTED] is this okay? Couldn't do it the exact way you specified, but `request` contains the JSON info.",
+ "path": "requests/models.py",
+ "line": 473,
+ "side": "RIGHT",
+ "created_at": "2021-05-04T14:26:23+00:00"
+ },
+ {
+ "id": 627659767,
+ "user": "user_0fa58b6f3572",
+ "body": "I have an instinct of \"No\" but that's because people do not read the docs and sometimes pass open files and such _in addition to_ the `json=` keyword and keeping a reference to those might not be _the best_ but that's a \"The user has shot themselves in the foot\" situation only for high traffic (lots of requests doing the wrong thing explicitly that has undefined behaviour), poorly designed software (because it's potentially not releasing/decref'ing the exception which doesn't decref the request which doesn't decref the file obj).\n\ntl;dr - This should be fine",
+ "path": "requests/models.py",
+ "line": 473,
+ "side": "RIGHT",
+ "created_at": "2021-05-06T18:14:57+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 2,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "6ab222745b98ca21",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.447075+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5797,
+ "title": "Switch LGPL'd chardet for MIT licensed charset_normalizer",
+ "body": "At least for Python 3 -- charset_normalizer doesn't support Python2, so for that chardet is still used -- this means the \"have chardet\" path is also still tested.\n\nAlthough using the (non-vendored) chardet library is fine for requests itself, but using a LGPL dependency the story is a lot less clear for downstream projects, particularly ones that might like to bundle requests (and thus chardet) in to a single binary -- think something similar to what docker-compose is doing. By [NAME_REDACTED] it is no longer clear if the resulting artefact must also be LGPL'd.\n\nBy [NAME_REDACTED] for one under MIT we remove all license ambiguity.\n\nAs an \"escape hatch\" I have made the code so that it will use chardet first if it is installed, but we no longer depend upon it directly, although there is a new extra added, `requests[lgpl]`. This should minimize the impact to users, and give them an escape hatch if charset_normalizer turns out to be not as good. (In my non-exhaustive tests it detects the same encoding as chartdet in every case I threw at it)\n\nI've read https://github.com/psf/requests/pull/4115, https://github.com/psf/requests/issues/3389, and https://github.com/chardet/chardet/issues/36#issuecomment-768281452 so I'm aware of the history, but I hope that the approach in this PR will allow this to be merged, as right now, the [NAME_REDACTED] doesn't allow projects to depend upon LGPL'd code (this is something I'm trying to get changed, but it is a _very_ slow process)",
+ "author": "user_ec9356a049f3",
+ "created_at": "2021-04-22T08:25:50+00:00",
+ "merged_at": "2021-07-06T23:55:02+00:00",
+ "base_branch": "master",
+ "head_branch": "charset_normalizer",
+ "additions": 119,
+ "deletions": 27,
+ "changed_files": 10,
+ "files": [
+ {
+ "filename": ".gitignore",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -23,6 +23,12 @@ env/\n \n .workon\n \n+# in case you work with IntelliJ/PyCharm\n+.idea\n+*.iml\n+.python-version\n+\n+\n t.py\n \n t2.py"
+ },
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 16,
+ "deletions": 1,
+ "changes": 17,
+ "patch": "@@ -6,6 +6,22 @@ dev\n \n - \\[Short description of non-trivial change.\\]\n \n+**Dependencies**\n+\n+- Instead of `chardet`, use the MIT-licensed `charset_normalizer` for Python3\n+ to remove license ambiguity for projects bundling requests. If `chardet`\n+ is already installed on your machine it will be used instead of `charset_normalizer`\n+ to keep backwards compatibility.\n+\n+ You can also install `chardet` while installing requests by\n+ specifying `[use_chardet_on_py3]` extra as follows:\n+\n+ ```shell\n+ pip install \"requests[use_chardet_on_py3]\"\n+ ```\n+\n+ Python2 still depends upon the `chardet` module.\n+\n 2.25.1 (2020-12-16)\n -------------------\n \n@@ -1707,4 +1723,3 @@ This is not a backwards compatible change.\n \n - Frustration\n - Conception\n-"
+ },
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 16,
+ "deletions": 4,
+ "changes": 20,
+ "patch": "@@ -697,10 +697,22 @@ [NAME_REDACTED] you receive a response, Requests makes a guess at the encoding to\n use for decoding the response when you access the :attr:`Response.text\n ` attribute. Requests will first check for an\n-encoding in the HTTP header, and if none is present, will use `chardet\n- `_ to attempt to guess the encoding.\n-\n-The only time Requests will not do this is if no explicit charset\n+encoding in the HTTP header, and if none is present, will use\n+`charset_normalizer `_\n+or `chardet `_ to attempt to\n+guess the encoding.\n+\n+If ``chardet`` is installed, ``requests`` uses it, however for python3\n+``chardet`` is no longer a mandatory dependency. The ``chardet``\n+library is an LGPL-licenced dependency and some users of requests\n+cannot depend on mandatory LGPL-licensed dependencies.\n+\n+When you install ``request`` without specifying ``[use_chardet_on_py3]]`` extra,\n+and ``chardet`` is not already installed, ``requests`` uses ``charset-normalizer``\n+(MIT-licensed) to guess the encoding. For Python 2, ``requests`` uses only\n+``chardet`` and is a mandatory dependency there.\n+\n+The only time Requests will not guess the encoding is if no explicit charset\n is present in the HTTP headers **and** the ``Content-Type``\n header contains ``text``. In this situation, `RFC 2616\n `_ specifies"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 26,
+ "deletions": 11,
+ "changes": 37,
+ "patch": "@@ -41,12 +41,20 @@\n \"\"\"\n \n import urllib3\n-import chardet\n import warnings\n from .exceptions import RequestsDependencyWarning\n \n+try:\n+ from charset_normalizer import __version__ as charset_normalizer_version\n+except ImportError:\n+ charset_normalizer_version = None\n \n-def check_compatibility(urllib3_version, chardet_version):\n+try:\n+ from chardet import __version__ as chardet_version\n+except ImportError:\n+ chardet_version = None\n+\n+def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version):\n urllib3_version = urllib3_version.split('.')\n assert urllib3_version != ['dev'] # Verify urllib3 isn't installed from git.\n \n@@ -62,12 +70,19 @@ def check_compatibility(urllib3_version, chardet_version):\n assert minor >= 21\n assert minor <= 26\n \n- # Check chardet for compatibility.\n- major, minor, patch = chardet_version.split('.')[:3]\n- major, minor, patch = int(major), int(minor), int(patch)\n- # chardet >= 3.0.2, < 5.0.0\n- assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)\n-\n+ # Check charset_normalizer for compatibility.\n+ if chardet_version:\n+ major, minor, patch = chardet_version.split('.')[:3]\n+ major, minor, patch = int(major), int(minor), int(patch)\n+ # chardet_version >= 3.0.2, < 5.0.0\n+ assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)\n+ elif charset_normalizer_version:\n+ major, minor, patch = charset_normalizer_version.split('.')[:3]\n+ major, minor, patch = int(major), int(minor), int(patch)\n+ # charset_normalizer >= 2.0.0 < 3.0.0\n+ assert (2, 0, 0) <= (major, minor, patch) < (3, 0, 0)\n+ else:\n+ raise Exception(\"You need either charset_normalizer or chardet installed\")\n \n def _check_cryptography(cryptography_version):\n # cryptography < 1.3.4\n@@ -82,10 +97,10 @@ def _check_cryptography(cryptography_version):\n \n # Check imported dependencies for compatibility.\n try:\n- check_compatibility(urllib3.__version__, chardet.__version__)\n+ check_compatibility(urllib3.__version__, chardet_version, charset_normalizer_version)\n except (AssertionError, ValueError):\n- warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n- \"version!\".format(urllib3.__version__, chardet.__version__),\n+ warnings.warn(\"urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported \"\n+ \"version!\".format(urllib3.__version__, chardet_version, charset_normalizer_version),\n RequestsDependencyWarning)\n \n # Attempt to enable urllib3's fallback for SNI support"
+ },
+ {
+ "filename": "requests/compat.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 1,
+ "changes": 5,
+ "patch": "@@ -8,7 +8,10 @@\n Python 3.\n \"\"\"\n \n-import chardet\n+try:\n+ import chardet\n+except ImportError:\n+ import charset_normalizer as chardet\n \n import sys"
+ },
+ {
+ "filename": "requests/help.py",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 2,
+ "changes": 20,
+ "patch": "@@ -8,10 +8,19 @@\n \n import idna\n import urllib3\n-import chardet\n \n from . import __version__ as requests_version\n \n+try:\n+ import charset_normalizer\n+except ImportError:\n+ charset_normalizer = None\n+\n+try:\n+ import chardet\n+except ImportError:\n+ chardet = None\n+\n try:\n from urllib3.contrib import pyopenssl\n except ImportError:\n@@ -71,7 +80,12 @@ def info():\n \n implementation_info = _implementation()\n urllib3_info = {'version': urllib3.__version__}\n- chardet_info = {'version': chardet.__version__}\n+ charset_normalizer_info = {'version': None}\n+ chardet_info = {'version': None}\n+ if charset_normalizer:\n+ charset_normalizer_info = {'version': charset_normalizer.__version__}\n+ if chardet:\n+ chardet_info = {'version': chardet.__version__}\n \n pyopenssl_info = {\n 'version': None,\n@@ -99,9 +113,11 @@ def info():\n 'implementation': implementation_info,\n 'system_ssl': system_ssl_info,\n 'using_pyopenssl': pyopenssl is not None,\n+ 'using_charset_normalizer': chardet is None,\n 'pyOpenSSL': pyopenssl_info,\n 'urllib3': urllib3_info,\n 'chardet': chardet_info,\n+ 'charset_normalizer': charset_normalizer_info,\n 'cryptography': cryptography_info,\n 'idna': idna_info,\n 'requests': {"
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -731,7 +731,7 @@ def next(self):\n \n [USER_REDACTED]\n def apparent_encoding(self):\n- \"\"\"The apparent encoding, provided by [NAME_REDACTED]\"\"\"\n+ \"\"\"The apparent encoding, provided by [NAME_REDACTED]_normalizer or chardet libraries.\"\"\"\n return chardet.detect(self.content)['encoding']\n \n def iter_content(self, chunk_size=1, decode_unicode=False):\n@@ -845,7 +845,7 @@ def text(self):\n \"\"\"Content of the response, in unicode.\n \n If Response.encoding is None, encoding will be guessed using\n- ``chardet``.\n+ ``charset_normalizer`` or ``chardet``.\n \n The encoding of the response content is determined based solely on HTTP\n headers, following RFC 2616 to the letter. If you can take advantage of\n@@ -893,7 +893,7 @@ def json(self, **kwargs):\n if not self.encoding and self.content and len(self.content) > 3:\n # No encoding set. JSON RFC 4627 section 3 states we should expect\n # UTF-8, -16 or -32. Detect which one to use; If the detection or\n- # decoding fails, fall back to `self.text` (using chardet to make\n+ # decoding fails, fall back to `self.text` (using charset_normalizer to make\n # a best guess).\n encoding = guess_json_utf(self.content)\n if encoding is not None:"
+ },
+ {
+ "filename": "requests/packages.py",
+ "status": "modified",
+ "additions": 13,
+ "deletions": 1,
+ "changes": 14,
+ "patch": "@@ -1,14 +1,26 @@\n import sys\n \n+try:\n+ import chardet\n+except ImportError:\n+ import charset_normalizer as chardet\n+ import warnings\n+\n+ warnings.filterwarnings('ignore', 'Trying to detect', module='charset_normalizer')\n+\n # This code exists for backwards compatibility reasons.\n # I don't like it either. Just look the other way. :)\n \n-for package in ('urllib3', 'idna', 'chardet'):\n+for package in ('urllib3', 'idna'):\n locals()[package] = __import__(package)\n # This traversal is apparently necessary such that the identities are\n # preserved (requests.packages.urllib3.* is urllib3.*)\n for mod in list(sys.modules):\n if mod == package or mod.startswith(package + '.'):\n sys.modules['requests.packages.' + mod] = sys.modules[mod]\n \n+target = chardet.__name__\n+for mod in list(sys.modules):\n+ if mod == target or mod.startswith(target + '.'):\n+ sys.modules['requests.packages.' + target.replace(target, 'chardet')] = sys.modules[mod]\n # Kinda cool, though, right?"
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -41,7 +41,8 @@ def run_tests(self):\n packages = ['requests']\n \n requires = [\n- 'chardet>=3.0.2,<5',\n+ 'charset_normalizer~=2.0.0; python_version >= \"3\"',\n+ 'chardet>=3.0.2,<5; python_version < \"3\"',\n 'idna>=2.5,<3',\n 'urllib3>=1.21.1,<1.27',\n 'certifi>=2017.4.17'\n@@ -103,6 +104,7 @@ def run_tests(self):\n 'security': ['pyOpenSSL >= 0.14', 'cryptography>=1.3.4'],\n 'socks': ['PySocks>=1.5.6, !=1.5.7'],\n 'socks:sys_platform == \"win32\" and python_version == \"2.7\"': ['win_inet_pton'],\n+ 'use_chardet_on_py3': ['chardet>=3.0.2,<5']\n },\n project_urls={\n 'Documentation': 'https://requests.readthedocs.io',"
+ },
+ {
+ "filename": "tox.ini",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 3,
+ "changes": 17,
+ "patch": "@@ -1,7 +1,18 @@\n [tox]\n-envlist = py27,py35,py36,py37,py38\n+envlist = py{27,35,36,37,38}-{default,use_chardet_on_py3}\n \n [testenv]\n-\n+deps = -rrequirements-dev.txt\n+extras =\n+ security\n+ socks\n commands =\n- python setup.py test\n+ pytest tests\n+\n+[testenv:default]\n+\n+[testenv:use_chardet_on_py3]\n+extras =\n+ security\n+ socks\n+ use_chardet_on_py3"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 665901224,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-21T21:16:35+00:00"
+ },
+ {
+ "id": 665903771,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-21T21:17:59+00:00"
+ },
+ {
+ "id": 670838338,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T00:15:43+00:00"
+ },
+ {
+ "id": 670904890,
+ "user": "user_61c1656236f3",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2021-05-28T03:54:21+00:00"
+ },
+ {
+ "id": 670961724,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:16:50+00:00"
+ },
+ {
+ "id": 670964516,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:21:54+00:00"
+ },
+ {
+ "id": 670964844,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:22:26+00:00"
+ },
+ {
+ "id": 670965143,
+ "user": "user_61c1656236f3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:22:55+00:00"
+ },
+ {
+ "id": 670965624,
+ "user": "user_61c1656236f3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:23:44+00:00"
+ },
+ {
+ "id": 670972836,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T06:36:15+00:00"
+ },
+ {
+ "id": 671047494,
+ "user": "user_61c1656236f3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T08:16:23+00:00"
+ },
+ {
+ "id": 671055273,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T08:25:32+00:00"
+ },
+ {
+ "id": 671112180,
+ "user": "user_61c1656236f3",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-05-28T09:30:08+00:00"
+ },
+ {
+ "id": 671150670,
+ "user": "user_0b8532a5e533",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T10:16:18+00:00"
+ },
+ {
+ "id": 671160068,
+ "user": "user_0b8532a5e533",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-05-28T10:28:52+00:00"
+ },
+ {
+ "id": 671256550,
+ "user": "user_116b15be3ae2",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T12:43:25+00:00"
+ },
+ {
+ "id": 671370415,
+ "user": "user_116b15be3ae2",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-28T14:36:49+00:00"
+ },
+ {
+ "id": 671777379,
+ "user": "user_116b15be3ae2",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-05-29T22:32:43+00:00"
+ },
+ {
+ "id": 671777511,
+ "user": "user_61c1656236f3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-29T22:35:37+00:00"
+ },
+ {
+ "id": 671793108,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-30T05:44:23+00:00"
+ },
+ {
+ "id": 671793122,
+ "user": "user_93734560a289",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-30T05:44:41+00:00"
+ },
+ {
+ "id": 699286030,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-05T15:32:08+00:00"
+ },
+ {
+ "id": 699287362,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": "This PR looks good, thank you for all the work and patience. I have one concern with the recent release of v2.0.0:",
+ "submitted_at": "2021-07-05T15:35:57+00:00"
+ },
+ {
+ "id": 699289157,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T15:36:53+00:00"
+ },
+ {
+ "id": 699290240,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-07-05T15:38:30+00:00"
+ },
+ {
+ "id": 699290535,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-05T15:38:57+00:00"
+ },
+ {
+ "id": 700437644,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Looks like we're set on the testing infra fixes. I'll leave final merge to [USER_REDACTED], but I think this looks alright.",
+ "submitted_at": "2021-07-06T22:44:46+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 637236978,
+ "user": "user_93734560a289",
+ "body": "```suggestion\n 'charset_normalizer~=1.4.0,<2; python_version >= \"3\"',\n```",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-21T21:16:35+00:00"
+ },
+ {
+ "id": 637237986,
+ "user": "user_93734560a289",
+ "body": "```suggestion\n 'charset_normalizer~=1.4.0; python_version >= \"3\"',\n```",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-21T21:17:59+00:00"
+ },
+ {
+ "id": 641068555,
+ "user": "user_0fa58b6f3572",
+ "body": "This seems somewhat disingenuous. For one thing, it's not the _only_ way to get `lgpl` dependencies. For another, it really exists to just force `chardet` to be installed on py3 so should be named something more like `use_chardet_on_py3`",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T00:15:43+00:00"
+ },
+ {
+ "id": 641229125,
+ "user": "user_61c1656236f3",
+ "body": "Maybe precise that if chardet is installed, it will still be used as it could confuse users.",
+ "path": "HISTORY.md",
+ "line": 24,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T03:41:55+00:00"
+ },
+ {
+ "id": 641230534,
+ "user": "user_61c1656236f3",
+ "body": "Maybe change the min to `(1, 4, 0)`.",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T03:43:16+00:00"
+ },
+ {
+ "id": 641240625,
+ "user": "user_61c1656236f3",
+ "body": "I would add a bit of explanation there. \n\n- What happens if chardet is installed\n- Keep both lib name as python 2 is keeping chardet by default",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T03:53:23+00:00"
+ },
+ {
+ "id": 641295078,
+ "user": "user_93734560a289",
+ "body": "Done",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:16:50+00:00"
+ },
+ {
+ "id": 641297212,
+ "user": "user_93734560a289",
+ "body": "Added.",
+ "path": "HISTORY.md",
+ "line": 24,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:21:54+00:00"
+ },
+ {
+ "id": 641297465,
+ "user": "user_93734560a289",
+ "body": "Changed to 1.4.1 to account for logging fix just added by [USER_REDACTED]",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:22:26+00:00"
+ },
+ {
+ "id": 641297716,
+ "user": "user_61c1656236f3",
+ "body": "Thanks!",
+ "path": "HISTORY.md",
+ "line": 24,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:22:54+00:00"
+ },
+ {
+ "id": 641298081,
+ "user": "user_61c1656236f3",
+ "body": ":+1:",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:23:44+00:00"
+ },
+ {
+ "id": 641303661,
+ "user": "user_93734560a289",
+ "body": "Updated.",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T06:36:15+00:00"
+ },
+ {
+ "id": 641360133,
+ "user": "user_61c1656236f3",
+ "body": "[USER_REDACTED] Missed the replacement there `use_chardet_on_py3`",
+ "path": "tox.ini",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T08:16:23+00:00"
+ },
+ {
+ "id": 641366129,
+ "user": "user_93734560a289",
+ "body": "Fixed. Thanks!",
+ "path": "tox.ini",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T08:25:32+00:00"
+ },
+ {
+ "id": 641438297,
+ "user": "user_0b8532a5e533",
+ "body": "```suggestion\n # charset_normalizer >= 1.4.1, < 2.0.0\n```",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T10:16:17+00:00"
+ },
+ {
+ "id": 641516746,
+ "user": "user_116b15be3ae2",
+ "body": "```suggestion\n- Instead of `chardet`, use the MIT-licensed `charset_normalizer` for Python3\n to remove license ambiguity for projects bundling requests. If `chardet`\n is already installed on your machine it will be used instead of `charset_normalizer`\n to keep backwards compatibility.\n\n You can also install `chardet` while installing requests by\n specifying `[use_chardet_on_py3]` extra as follows:\n\n ```shell\n pip install \"requests[use_chardet_on_py3]\"\n ```\n```",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T12:40:09+00:00"
+ },
+ {
+ "id": 641517560,
+ "user": "user_116b15be3ae2",
+ "body": "```suggestion\nand ``chardet`` is not already installed, ``requests`` uses ``charset-normalizer``\n```",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T12:41:22+00:00"
+ },
+ {
+ "id": 641600649,
+ "user": "user_116b15be3ae2",
+ "body": "Something went wrong with that suggestion .. the ending triple quotes disappeared somehow, try this\n\n```suggestion\n ```shell\n pip install \"requests[use_chardet_on_py3]\"\n ```\n```",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-28T14:36:49+00:00"
+ },
+ {
+ "id": 641991272,
+ "user": "user_61c1656236f3",
+ "body": "[USER_REDACTED] missed a « lgpl » here. It is the last one.",
+ "path": "tox.ini",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-29T22:35:36+00:00"
+ },
+ {
+ "id": 642023066,
+ "user": "user_93734560a289",
+ "body": "Too much reliance on Ci (which is not running because of workflow awaiting approval :)",
+ "path": "tox.ini",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-30T05:44:22+00:00"
+ },
+ {
+ "id": 642023099,
+ "user": "user_93734560a289",
+ "body": "This time I actually run it before last fixup locally.",
+ "path": "tox.ini",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-30T05:44:41+00:00"
+ },
+ {
+ "id": 664014262,
+ "user": "user_b08fb5f52ea1",
+ "body": "If charset_normalizer v2.0.0 is out do we need to update this to be >2?",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T15:34:07+00:00"
+ },
+ {
+ "id": 664014844,
+ "user": "user_b08fb5f52ea1",
+ "body": "Do we need to update this with v2.0.0?",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T15:35:12+00:00"
+ },
+ {
+ "id": 664015764,
+ "user": "user_0fa58b6f3572",
+ "body": "We haven't tested v2. I'd rather get something imperfect out than something perfect. Today's literally the only time I've had to review anything",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T15:36:53+00:00"
+ },
+ {
+ "id": 664016609,
+ "user": "user_b08fb5f52ea1",
+ "body": "Makes sense, I/we can handle the upgrade in a follow-up PR.",
+ "path": "setup.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-07-05T15:38:30+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "ini",
+ "md",
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 20,
+ "CHANGES_REQUESTED": 1,
+ "APPROVED": 6
+ },
+ "meaningful_comment_count": 20,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 25
+ }
+}
+{
+ "_id": "a061ddc01b452dd2",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.449105+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5783,
+ "title": "Add support for brotli decoding",
+ "body": "When the `brotli` or `brotlicffi` packages are installed, `urllib3.util.make_headers()` inserts ',br' in the Accept-Encoding header and decodes br from the answers.",
+ "author": "user_9307f64f5cd5",
+ "created_at": "2021-03-29T18:53:59+00:00",
+ "merged_at": "2021-07-07T13:16:28+00:00",
+ "base_branch": "master",
+ "head_branch": "brotli_decoding",
+ "additions": 15,
+ "deletions": 1,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 0,
+ "changes": 2,
+ "patch": "@@ -5,6 +5,8 @@ dev\n ---\n \n - \\[Short description of non-trivial change.\\]\n+- [NAME_REDACTED] compression, if either the `brotli` or `brotlicffi` package\n+ is installed.\n \n 2.25.1 (2020-12-16)\n -------------------"
+ },
+ {
+ "filename": "docs/community/faq.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -11,6 +11,9 @@ [NAME_REDACTED]?\n Requests automatically decompresses gzip-encoded responses, and does\n its best to decode response content to unicode when possible.\n \n+When either the `brotli `_ or `brotlicffi `_\n+package is installed, requests also decodes Brotli-encoded responses.\n+\n You can get direct access to the raw response (and even the socket),\n if needed as well."
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -128,6 +128,9 @@ You can also access the response body as bytes, for non-text requests::\n \n The ``gzip`` and ``deflate`` transfer-encodings are automatically decoded for you.\n \n+The ``br`` transfer-encoding is automatically decoded for you if a Brotli library\n+like `brotli `_ or `brotlicffi `_ is installed.\n+\n For example, to create an image from binary data returned by a request, you can\n use the following code::"
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 1,
+ "changes": 8,
+ "patch": "@@ -20,6 +20,7 @@\n import warnings\n import zipfile\n from collections import OrderedDict\n+from urllib3.util import make_headers\n \n from .__version__ import __version__\n from . import certs\n@@ -41,6 +42,11 @@\n \n DEFAULT_PORTS = {'http': 80, 'https': 443}\n \n+# Ensure that ', ' is used to preserve previous delimiter behavior.\n+DEFAULT_ACCEPT_ENCODING = \", \".join(\n+ re.split(r\",\\s*\", make_headers(accept_encoding=True)[\"accept-encoding\"])\n+)\n+\n \n if sys.platform == 'win32':\n # provide a proxy_bypass version on Windows without DNS lookups\n@@ -820,7 +826,7 @@ def default_headers():\n \"\"\"\n return CaseInsensitiveDict({\n 'User-Agent': default_user_agent(),\n- 'Accept-Encoding': ', '.join(('gzip', 'deflate')),\n+ 'Accept-Encoding': DEFAULT_ACCEPT_ENCODING,\n 'Accept': '*/*',\n 'Connection': 'keep-alive',\n })"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 648821963,
+ "user": "user_b08fb5f52ea1",
+ "state": "CHANGES_REQUESTED",
+ "body": "This looks mostly good, few comments for you. Also can we add a test for this?",
+ "submitted_at": "2021-05-20T20:57:47+00:00"
+ },
+ {
+ "id": 665228283,
+ "user": "user_9307f64f5cd5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-21T08:41:32+00:00"
+ },
+ {
+ "id": 665232055,
+ "user": "user_9307f64f5cd5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-05-21T08:45:36+00:00"
+ },
+ {
+ "id": 700981392,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "I'm now happy with my changes but I'd like another reviewer to take a quick peek now that I'm the author [NAME_REDACTED] diff. cc [USER_REDACTED] [USER_REDACTED]",
+ "submitted_at": "2021-07-07T13:06:57+00:00"
+ },
+ {
+ "id": 700992139,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-07T13:16:22+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 623550350,
+ "user": "user_b08fb5f52ea1",
+ "body": "Can we link to the individual packages here?",
+ "path": "docs/community/faq.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-04-30T02:51:17+00:00"
+ },
+ {
+ "id": 623550420,
+ "user": "user_b08fb5f52ea1",
+ "body": "nit: Brotli is a proper name so should be capitalized here and in the changelog",
+ "path": "docs/community/faq.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-04-30T02:51:33+00:00"
+ },
+ {
+ "id": 636462152,
+ "user": "user_b08fb5f52ea1",
+ "body": "Should we generate this header once and store the result so it doesn't need to be called every time? The value is determined by [NAME_REDACTED] changing often.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-20T20:52:06+00:00"
+ },
+ {
+ "id": 636744118,
+ "user": "user_9307f64f5cd5",
+ "body": "I have capitalized Brotli-decompression on both places.",
+ "path": "docs/community/faq.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-21T08:41:31+00:00"
+ },
+ {
+ "id": 636746931,
+ "user": "user_9307f64f5cd5",
+ "body": "This optimization makes sense. I kindly ask you to implement it in the way, you think fits best.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-05-21T08:45:36+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 2,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 5
+ }
+}
+{
+ "_id": "6c4526377405ea6c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.452326+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5777,
+ "title": "quickstart.rst: r.json() can raise JSONDecodeError on Py3",
+ "body": "% `python2 -c \"import requests ; requests.get('https://github.com').json()\"`\n% `python3 -c \"import requests ; requests.get('https://github.com').json()\"`\n\nPython | Simplejson is installed | Simplejson is NOT installed\n--- | --- | ---\nPython 2 | simplejson.JSONDecodeError | ValueError\nPython 3 | simplejson.JSONDecodeError | json.JSONDecodeError",
+ "author": "user_bf0bce4a5e56",
+ "created_at": "2021-03-18T09:06:28+00:00",
+ "merged_at": "2021-03-18T14:36:35+00:00",
+ "base_branch": "master",
+ "head_branch": "patch-1",
+ "additions": 9,
+ "deletions": 2,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -150,7 +150,9 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data::\n \n In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if\n the response gets a 204 ([NAME_REDACTED]), or if the response contains invalid JSON,\n-attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded``.\n+attempting ``r.json()`` raises ``simplejson.JSONDecodeError`` if simplejson is\n+installed or raises ``ValueError: No JSON object could be decoded`` on Python 2 or\n+``json.JSONDecodeError`` on Python 3.\n \n It should be noted that the success of the call to ``r.json()`` does **not**\n indicate the success of the response. Some servers may return a JSON object in a"
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -877,7 +877,12 @@ def json(self, **kwargs):\n r\"\"\"Returns the json-encoded content of a response, if any.\n \n :param \\*\\*kwargs: Optional arguments that ``json.loads`` takes.\n- :raises ValueError: If the response body does not contain valid json.\n+ :raises simplejson.JSONDecodeError: If the response body does not\n+ contain valid json and simplejson is installed.\n+ :raises json.JSONDecodeError: If the response body does not contain\n+ valid json and simplejson is not installed on Python 3.\n+ :raises ValueError: If the response body does not contain valid\n+ json and simplejson is not installed on Python 2. \n \"\"\"\n \n if not self.encoding and self.content and len(self.content) > 3:"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 615246092,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-03-18T11:14:33+00:00"
+ },
+ {
+ "id": 615256568,
+ "user": "user_bf0bce4a5e56",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-03-18T11:19:48+00:00"
+ },
+ {
+ "id": 615466954,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-03-18T14:36:31+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 596760730,
+ "user": "user_0fa58b6f3572",
+ "body": "Does `simplejson` raise a `ValueError` on Py2?",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-03-18T11:14:33+00:00"
+ },
+ {
+ "id": 596763999,
+ "user": "user_bf0bce4a5e56",
+ "body": "Yes. Good catch. Thanks.",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2021-03-18T11:19:48+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "044c49b6189df9ad",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.452326+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5707,
+ "title": "Avoid zip extract racing condition by [NAME_REDACTED]+write instead extract",
+ "body": "Extract also creates the folder hierarchy, however we do not need that,\nthe file itself being extracted to a temporary folder is good enough.\nInstead we read the content of the zip and then write it. The write is\nnot locked but it's OK to update the same file multiple times given the\nupdate operation will not alter the content of the file. By [NAME_REDACTED] hierarchy (default via extract) we no longer can run into the\nproblem of two parallel extracts both trying to create the folder\nhierarchy without exists ok flag, and one must fail.\n\nResolves #5223.\n\nSigned-off-by: Bernát Gábor <[EMAIL_REDACTED]>",
+ "author": "user_f6bd397772c3",
+ "created_at": "2020-12-24T19:20:04+00:00",
+ "merged_at": "2021-07-07T00:14:52+00:00",
+ "base_branch": "master",
+ "head_branch": "5223",
+ "additions": 18,
+ "deletions": 3,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 3,
+ "changes": 21,
+ "patch": "@@ -256,13 +256,28 @@ def extract_zipped_paths(path):\n \n # we have a valid zip archive and a valid member of that archive\n tmp = tempfile.gettempdir()\n- extracted_path = os.path.join(tmp, *member.split('/'))\n+ extracted_path = os.path.join(tmp, member.split('/')[-1])\n if not os.path.exists(extracted_path):\n- extracted_path = zip_file.extract(member, path=tmp)\n-\n+ # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition\n+ with atomic_open(extracted_path) as file_handler:\n+ file_handler.write(zip_file.read(member))\n return extracted_path\n \n \n+[USER_REDACTED].contextmanager\n+def atomic_open(filename):\n+ \"\"\"Write a file to the disk in an atomic fashion\"\"\"\n+ replacer = os.rename if sys.version_info[0] == 2 else os.replace\n+ tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename))\n+ try:\n+ with os.fdopen(tmp_descriptor, 'wb') as tmp_handler:\n+ yield tmp_handler\n+ replacer(tmp_name, filename)\n+ except BaseException:\n+ os.remove(tmp_name)\n+ raise\n+\n+\n def from_key_val_list(value):\n \"\"\"Take an object and test to see if it can be represented as a\n dictionary. Unless it can not be represented as such, return an"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 558723323,
+ "user": "user_f6bd397772c3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-12-24T23:18:20+00:00"
+ },
+ {
+ "id": 700473285,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-07-07T00:14:46+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 548761782,
+ "user": "user_f6bd397772c3",
+ "body": "Just to handle a further race condition that can happen between opening and writing the file.",
+ "path": "requests/utils.py",
+ "line": 268,
+ "side": "RIGHT",
+ "created_at": "2020-12-24T23:18:20+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "2e27bc990a24dd9e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.452326+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5681,
+ "title": "5677: Rebuild proxies on Session#send",
+ "body": "- Adds some test cases to highlight the issue, some of those seem excessive, I would like suggestions on how to combine them.\n- Rebuilds the proxy configuration on `send`, making it behave like `requests.Session#request` that already did that.",
+ "author": "user_e3e9f7e88b44",
+ "created_at": "2020-12-08T17:39:44+00:00",
+ "merged_at": "2021-01-24T22:59:47+00:00",
+ "base_branch": "master",
+ "head_branch": "5677",
+ "additions": 40,
+ "deletions": 1,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -633,7 +633,7 @@ def send(self, request, **kwargs):\n kwargs.setdefault('stream', self.stream)\n kwargs.setdefault('verify', self.verify)\n kwargs.setdefault('cert', self.cert)\n- kwargs.setdefault('proxies', self.proxies)\n+ kwargs.setdefault('proxies', self.rebuild_proxies(request, self.proxies))\n \n # It's possible that users might accidentally send a Request object.\n # Guard against that specific failure case."
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 39,
+ "deletions": 0,
+ "changes": 39,
+ "patch": "@@ -40,6 +40,9 @@\n # listening on that port)\n TARPIT = 'http://10.255.255.1'\n \n+# This is to avoid waiting the timeout of using TARPIT\n+INVALID_PROXY='http://localhost:1'\n+\n try:\n from ssl import SSLContext\n del SSLContext\n@@ -551,6 +554,42 @@ def test_proxy_error_on_bad_url(self, httpbin, httpbin_secure):\n with pytest.raises(InvalidProxyURL):\n requests.get(httpbin(), proxies={'http': 'http:///example.com:8080'})\n \n+ def test_respect_proxy_env_on_send_self_prepared_request(self, httpbin):\n+ with override_environ(http_proxy=INVALID_PROXY):\n+ with pytest.raises(ProxyError):\n+ session = requests.Session()\n+ request = requests.Request('GET', httpbin())\n+ session.send(request.prepare())\n+\n+ def test_respect_proxy_env_on_send_session_prepared_request(self, httpbin):\n+ with override_environ(http_proxy=INVALID_PROXY):\n+ with pytest.raises(ProxyError):\n+ session = requests.Session()\n+ request = requests.Request('GET', httpbin())\n+ prepared = session.prepare_request(request)\n+ session.send(prepared)\n+\n+ def test_respect_proxy_env_on_send_with_redirects(self, httpbin):\n+ with override_environ(http_proxy=INVALID_PROXY):\n+ with pytest.raises(ProxyError):\n+ session = requests.Session()\n+ url = httpbin('redirect/1')\n+ print(url)\n+ request = requests.Request('GET', url)\n+ session.send(request.prepare())\n+\n+ def test_respect_proxy_env_on_get(self, httpbin):\n+ with override_environ(http_proxy=INVALID_PROXY):\n+ with pytest.raises(ProxyError):\n+ session = requests.Session()\n+ session.get(httpbin())\n+\n+ def test_respect_proxy_env_on_request(self, httpbin):\n+ with override_environ(http_proxy=INVALID_PROXY):\n+ with pytest.raises(ProxyError):\n+ session = requests.Session()\n+ session.request(method='GET', url=httpbin())\n+\n def test_basicauth_with_netrc(self, httpbin):\n auth = ('user', 'pass')\n wrong_auth = ('wronguser', 'wrongpass')"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 549552538,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-12-10T19:56:30+00:00"
+ },
+ {
+ "id": 549691778,
+ "user": "user_e3e9f7e88b44",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-12-10T23:25:08+00:00"
+ },
+ {
+ "id": 574960999,
+ "user": "user_e3e9f7e88b44",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2021-01-24T19:25:43+00:00"
+ },
+ {
+ "id": 575000055,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2021-01-24T22:59:37+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 540455485,
+ "user": "user_0fa58b6f3572",
+ "body": "I'm 99% certain this isn't actually correct. This does work regardless of whether it's used or not. We should do:\n\n```py\nif kwargs['proxies']:\n kwargs['proxies'] = self.rebuild_proxies(request, kwargs['proxies'])\n```\n\nAfter this line though",
+ "path": "requests/sessions.py",
+ "line": 636,
+ "side": "RIGHT",
+ "created_at": "2020-12-10T19:56:30+00:00"
+ },
+ {
+ "id": 540575159,
+ "user": "user_e3e9f7e88b44",
+ "body": "What do you mean by \"this\"?\n\nThe problem or the proposed solution?\n\nFor the problem, I've added a fell test cases, which when I remove this line change those were not passing.\n\nAs for the solution.\n\nShould the `proxies` parameter be overwritten by [NAME_REDACTED]?\n\nIf we `rebuild_proxies` there, it will load the environment variables, instead of using what is being passed on the arguments, my solution intentionally considers the arguments as the highest priority.",
+ "path": "requests/sessions.py",
+ "line": 636,
+ "side": "RIGHT",
+ "created_at": "2020-12-10T23:25:07+00:00"
+ },
+ {
+ "id": 563337600,
+ "user": "user_e3e9f7e88b44",
+ "body": "[USER_REDACTED] \n\nDoes my answer help you understand the problem in any way?\n\nI'm facing this problem in production and the tests do show the inconsistent use of proxy environment variables by `requests.session`.",
+ "path": "requests/sessions.py",
+ "line": 636,
+ "side": "RIGHT",
+ "created_at": "2021-01-24T19:25:43+00:00"
+ },
+ {
+ "id": 563398766,
+ "user": "user_0fa58b6f3572",
+ "body": "I don't recall 😆 but your logic makes sense.",
+ "path": "requests/sessions.py",
+ "line": 636,
+ "side": "RIGHT",
+ "created_at": "2021-01-24T22:59:34+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "cd11201283f49160",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.468723+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5652,
+ "title": "Move CI to [NAME_REDACTED]",
+ "body": "Moving us to GH Actions since our Travis configs are in relative disarray and we haven't been running Mac/Windows builds for years at this point.\n\n### Other changes in this PR:\n\n**Pipenv**\nPipenv has caused a lot of friction with users trying to submit PR updates that need dependency changes, so this removes it. I've readded a `requirements-dev.txt` to store dev dependencies.\n\n**Removal of pytest-xdist**\n`pytest-xdist` causes threading issues on macOS for some versions of Python [StackOverflow issue](https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr/52230415). The performance gain on tests is negligible, so I've removed it for config simplicity. If there's strong demand, we could attempt the bash updates or split out the macOS test command in the action definition.\n\n**[NAME_REDACTED] 3.9**\nAdding 3.9 to tests so we can update our trove classifiers before releasing 2.25.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2020-11-10T22:27:27+00:00",
+ "merged_at": "2020-11-11T18:29:14+00:00",
+ "base_branch": "master",
+ "head_branch": "github_actions",
+ "additions": 48,
+ "deletions": 1118,
+ "changed_files": 10,
+ "files": [
+ {
+ "filename": ".github/workflows/run-tests.yml",
+ "status": "added",
+ "additions": 31,
+ "deletions": 0,
+ "changes": 31,
+ "patch": "@@ -0,0 +1,31 @@\n+name: Tests\n+\n+on: [push, pull_request]\n+\n+jobs:\n+ build:\n+ runs-on: ${{ matrix.os }}\n+\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]\n+ os: [ubuntu-latest, macOS-latest, windows-latest]\n+ include:\n+ # pypy3 on Mac OS currently fails trying to compile\n+ # brotlipy. Moving pypy3 to only test linux.\n+ - python-version: pypy3\n+ os: ubuntu-latest\n+\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Set up Python ${{ matrix.python-version }}\n+ uses: actions/setup-python@v2\n+ with:\n+ python-version: ${{ matrix.python-version }}\n+ - name: Install dependencies\n+ run: |\n+ make\n+ - name: Run tests\n+ run: |\n+ make ci"
+ },
+ {
+ "filename": ".travis.yml",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 26,
+ "changes": 26,
+ "patch": "@@ -1,26 +0,0 @@\n-language: python\n-# command to install dependencies\n-install: \"make\"\n-# command to run tests\n-script:\n- - make test-readme\n- - make ci\n-cache: pip\n-jobs:\n- include:\n- - stage: test\n- python: '2.7'\n- - stage: test\n- python: '3.5'\n- - stage: test\n- python: '3.6'\n- - stage: test\n- python: '3.7' \n- - stage: test\n- python: 'pypy3'\n- dist: xenial\n- - stage: test\n- python: '3.8'\n- - stage: coverage\n- python: '3.6'\n- script: codecov"
+ },
+ {
+ "filename": "MANIFEST.in",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,2 +1,2 @@\n-include README.md LICENSE NOTICE HISTORY.md pytest.ini requirements.txt [NAME_REDACTED]\n+include README.md LICENSE NOTICE HISTORY.md pytest.ini requirements-dev.txt\n recursive-include tests *.py"
+ },
+ {
+ "filename": "Makefile",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 7,
+ "changes": 14,
+ "patch": "@@ -1,21 +1,21 @@\n .PHONY: docs\n init:\n-\tpip install pipenv --upgrade\n-\tpipenv install --dev\n+\tpip install -e .[socks]\n+\tpip install -r requirements-dev.txt\n test:\n \t# This runs all of the tests, on both Python 2 and Python 3.\n \tdetox\n ci:\n-\tpipenv run py.test -n 8 --boxed --junitxml=report.xml\n+\tpytest tests --junitxml=report.xml\n \n test-readme:\n-\t[USER_REDACTED] run python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo \"README.rst and HISTORY.rst ok\") || echo \"Invalid markup in README.rst or HISTORY.rst!\"\n+\tpython setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo \"README.rst and HISTORY.rst ok\") || echo \"Invalid markup in README.rst or HISTORY.rst!\"\n \n flake8:\n-\tpipenv run flake8 --ignore=E501,F401,E128,E402,E731,F821 requests\n+\tflake8 --ignore=E501,F401,E128,E402,E731,F821 requests\n \n coverage:\n-\tpipenv run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests\n+\tpytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests\n \n publish:\n \tpip install 'twine>=1.5.0'\n@@ -25,4 +25,4 @@ publish:\n \n docs:\n \tcd docs && make html\n-\t[USER_REDACTED] \"\\033[95m\\n\\nBuild successful! View the docs homepage at docs/_build/html/index.html.\\n\\033[0m\"\n\\ No newline at end of file\n+\t[USER_REDACTED] \"\\033[95m\\n\\nBuild successful! View the docs homepage at docs/_build/html/index.html.\\n\\033[0m\""
+ },
+ {
+ "filename": "Pipfile",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 25,
+ "changes": 25,
+ "patch": "@@ -1,25 +0,0 @@\n-[[source]]\n-url = \"https://pypi.org/simple/\"\n-verify_ssl = true\n-name = \"pypi\"\n-\n-[dev-packages]\n-alabaster = \"*\"\n-codecov = \"*\"\n-docutils = \"*\"\n-detox = \"*\"\n-\"flake8\" = \"*\"\n-httpbin = \">=0.7.0\"\n-more-itertools = \"<6.0\"\n-pysocks = \"*\"\n-pytest = \">=2.8.0,<=3.10.1\"\n-pytest-httpbin = \">=0.0.7,<1.0\"\n-pytest-mock = \"*\"\n-pytest-cov = \"*\"\n-pytest-xdist = \"<=1.25\"\n-readme-renderer = \"*\"\n-sphinx = \"<=1.5.5\"\n-tox = \"*\"\n-\n-[packages]\n-\"requests\" = {path = \".\", editable = true, extras = [\"socks\"]}"
+ },
+ {
+ "filename": "Pipfile.lock",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 765,
+ "changes": 765,
+ "patch": "@@ -1,765 +0,0 @@\n-{\n- \"_meta\": {\n- \"hash\": {\n- \"sha256\": \"9c8d31d74dee008bc23d846267f23665288b0b1bee2525baca681d1061726701\"\n- },\n- \"pipfile-spec\": 6,\n- \"requires\": {},\n- \"sources\": [\n- {\n- \"name\": \"pypi\",\n- \"url\": \"https://pypi.org/simple/\",\n- \"verify_ssl\": true\n- }\n- ]\n- },\n- \"default\": {\n- \"certifi\": {\n- \"hashes\": [\n- \"sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3\",\n- \"sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f\"\n- ],\n- \"version\": \"==2019.11.28\"\n- },\n- \"chardet\": {\n- \"hashes\": [\n- \"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae\",\n- \"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691\"\n- ],\n- \"version\": \"==3.0.4\"\n- },\n- \"idna\": {\n- \"hashes\": [\n- \"sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb\",\n- \"sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa\"\n- ],\n- \"version\": \"==2.9\"\n- },\n- \"pysocks\": {\n- \"hashes\": [\n- \"sha256:08e69f092cc6dbe92a0fdd16eeb9b9ffbc13cadfe5ca4c7bd92ffb078b293299\",\n- \"sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5\",\n- \"sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0\"\n- ],\n- \"version\": \"==1.7.1\"\n- },\n- \"requests\": {\n- \"editable\": true,\n- \"extras\": [\n- \"socks\"\n- ],\n- \"path\": \".\"\n- },\n- \"urllib3\": {\n- \"hashes\": [\n- \"sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc\",\n- \"sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc\"\n- ],\n- \"version\": \"==1.25.8\"\n- }\n- },\n- \"develop\": {\n- \"alabaster\": {\n- \"hashes\": [\n- \"sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359\",\n- \"sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==0.7.12\"\n- },\n- \"apipkg\": {\n- \"hashes\": [\n- \"sha256:37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6\",\n- \"sha256:58587dd4dc3daefad0487f6d9ae32b4542b185e1c36db6993290e7c41ca2b47c\"\n- ],\n- \"version\": \"==1.5\"\n- },\n- \"appdirs\": {\n- \"hashes\": [\n- \"sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92\",\n- \"sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e\"\n- ],\n- \"version\": \"==1.4.3\"\n- },\n- \"atomicwrites\": {\n- \"hashes\": [\n- \"sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4\",\n- \"sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6\"\n- ],\n- \"version\": \"==1.3.0\"\n- },\n- \"attrs\": {\n- \"hashes\": [\n- \"sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c\",\n- \"sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72\"\n- ],\n- \"version\": \"==19.3.0\"\n- },\n- \"babel\": {\n- \"hashes\": [\n- \"sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38\",\n- \"sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4\"\n- ],\n- \"version\": \"==2.8.0\"\n- },\n- \"bleach\": {\n- \"hashes\": [\n- \"sha256:cc8da25076a1fe56c3ac63671e2194458e0c4d9c7becfd52ca251650d517903c\",\n- \"sha256:e78e426105ac07026ba098f04de8abe9b6e3e98b5befbf89b51a5ef0a4292b03\"\n- ],\n- \"version\": \"==3.1.4\"\n- },\n- \"blinker\": {\n- \"hashes\": [\n- \"sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6\"\n- ],\n- \"version\": \"==1.4\"\n- },\n- \"brotlipy\": {\n- \"hashes\": [\n- \"sha256:07194f4768eb62a4f4ea76b6d0df6ade185e24ebd85877c351daa0a069f1111a\",\n- \"sha256:091b299bf36dd6ef7a06570dbc98c0f80a504a56c5b797f31934d2ad01ae7d17\",\n- \"sha256:09ec3e125d16749b31c74f021aba809541b3564e5359f8c265cbae442810b41a\",\n- \"sha256:0be698678a114addcf87a4b9496c552c68a2c99bf93cf8e08f5738b392e82057\",\n- \"sha256:0fa6088a9a87645d43d7e21e32b4a6bf8f7c3939015a50158c10972aa7f425b7\",\n- \"sha256:1379347337dc3d20b2d61456d44ccce13e0625db2611c368023b4194d5e2477f\",\n- \"sha256:1ea4e578241504b58f2456a6c69952c88866c794648bdc74baee74839da61d44\",\n- \"sha256:2699945a0a992c04fc7dc7fa2f1d0575a2c8b4b769f2874a08e8eae46bef36ae\",\n- \"sha256:2a80319ae13ea8dd60ecdc4f5ccf6da3ae64787765923256b62c598c5bba4121\",\n- \"sha256:2e5c64522364a9ebcdf47c5744a5ddeb3f934742d31e61ebfbbc095460b47162\",\n- \"sha256:36def0b859beaf21910157b4c33eb3b06d8ce459c942102f16988cca6ea164df\",\n- \"sha256:3a3e56ced8b15fbbd363380344f70f3b438e0fd1fcf27b7526b6172ea950e867\",\n- \"sha256:3c1d5e2cf945a46975bdb11a19257fa057b67591eb232f393d260e7246d9e571\",\n- \"sha256:4e4638b49835d567d447a2cfacec109f9a777f219f071312268b351b6839436d\",\n- \"sha256:50ca336374131cfad20612f26cc43c637ac0bfd2be3361495e99270883b52962\",\n- \"sha256:5de6f7d010b7558f72f4b061a07395c5c3fd57f0285c5af7f126a677b976a868\",\n- \"sha256:637847560d671657f993313ecc6c6c6666a936b7a925779fd044065c7bc035b9\",\n- \"sha256:653faef61241bf8bf99d73ca7ec4baa63401ba7b2a2aa88958394869379d67c7\",\n- \"sha256:786afc8c9bd67de8d31f46e408a3386331e126829114e4db034f91eacb05396d\",\n- \"sha256:79aaf217072840f3e9a3b641cccc51f7fc23037496bd71e26211856b93f4b4cb\",\n- \"sha256:7e31f7adcc5851ca06134705fcf3478210da45d35ad75ec181e1ce9ce345bb38\",\n- \"sha256:8b39abc3256c978f575df5cd7893153277216474f303e26f0e43ba3d3969ef96\",\n- \"sha256:9448227b0df082e574c45c983fa5cd4bda7bfb11ea6b59def0940c1647be0c3c\",\n- \"sha256:96bc59ff9b5b5552843dc67999486a220e07a0522dddd3935da05dc194fa485c\",\n- \"sha256:a07647886e24e2fb2d68ca8bf3ada398eb56fd8eac46c733d4d95c64d17f743b\",\n- \"sha256:af65d2699cb9f13b26ec3ba09e75e80d31ff422c03675fcb36ee4dabe588fdc2\",\n- \"sha256:b4c98b0d2c9c7020a524ca5bbff42027db1004c6571f8bc7b747f2b843128e7a\",\n- \"sha256:c6cc0036b1304dd0073eec416cb2f6b9e37ac8296afd9e481cac3b1f07f9db25\",\n- \"sha256:d2c1c724c4ac375feb2110f1af98ecdc0e5a8ea79d068efb5891f621a5b235cb\",\n- \"sha256:dc6c5ee0df9732a44d08edab32f8a616b769cc5a4155a12d2d010d248eb3fb07\",\n- \"sha256:fd1d1c64214af5d90014d82cee5d8141b13d44c92ada7a0c0ec0679c6f15a471\"\n- ],\n- \"version\": \"==0.7.0\"\n- },\n- \"certifi\": {\n- \"hashes\": [\n- \"sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3\",\n- \"sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f\"\n- ],\n- \"version\": \"==2019.11.28\"\n- },\n- \"cffi\": {\n- \"hashes\": [\n- \"sha256:001bf3242a1bb04d985d63e138230802c6c8d4db3668fb545fb5005ddf5bb5ff\",\n- \"sha256:00789914be39dffba161cfc5be31b55775de5ba2235fe49aa28c148236c4e06b\",\n- \"sha256:028a579fc9aed3af38f4892bdcc7390508adabc30c6af4a6e4f611b0c680e6ac\",\n- \"sha256:14491a910663bf9f13ddf2bc8f60562d6bc5315c1f09c704937ef17293fb85b0\",\n- \"sha256:1cae98a7054b5c9391eb3249b86e0e99ab1e02bb0cc0575da191aedadbdf4384\",\n- \"sha256:2089ed025da3919d2e75a4d963d008330c96751127dd6f73c8dc0c65041b4c26\",\n- \"sha256:2d384f4a127a15ba701207f7639d94106693b6cd64173d6c8988e2c25f3ac2b6\",\n- \"sha256:337d448e5a725bba2d8293c48d9353fc68d0e9e4088d62a9571def317797522b\",\n- \"sha256:399aed636c7d3749bbed55bc907c3288cb43c65c4389964ad5ff849b6370603e\",\n- \"sha256:3b911c2dbd4f423b4c4fcca138cadde747abdb20d196c4a48708b8a2d32b16dd\",\n- \"sha256:3d311bcc4a41408cf5854f06ef2c5cab88f9fded37a3b95936c9879c1640d4c2\",\n- \"sha256:62ae9af2d069ea2698bf536dcfe1e4eed9090211dbaafeeedf5cb6c41b352f66\",\n- \"sha256:66e41db66b47d0d8672d8ed2708ba91b2f2524ece3dee48b5dfb36be8c2f21dc\",\n- \"sha256:675686925a9fb403edba0114db74e741d8181683dcf216be697d208857e04ca8\",\n- \"sha256:7e63cbcf2429a8dbfe48dcc2322d5f2220b77b2e17b7ba023d6166d84655da55\",\n- \"sha256:8a6c688fefb4e1cd56feb6c511984a6c4f7ec7d2a1ff31a10254f3c817054ae4\",\n- \"sha256:8c0ffc886aea5df6a1762d0019e9cb05f825d0eec1f520c51be9d198701daee5\",\n- \"sha256:95cd16d3dee553f882540c1ffe331d085c9e629499ceadfbda4d4fde635f4b7d\",\n- \"sha256:99f748a7e71ff382613b4e1acc0ac83bf7ad167fb3802e35e90d9763daba4d78\",\n- \"sha256:b8c78301cefcf5fd914aad35d3c04c2b21ce8629b5e4f4e45ae6812e461910fa\",\n- \"sha256:c420917b188a5582a56d8b93bdd8e0f6eca08c84ff623a4c16e809152cd35793\",\n- \"sha256:c43866529f2f06fe0edc6246eb4faa34f03fe88b64a0a9a942561c8e22f4b71f\",\n- \"sha256:cab50b8c2250b46fe738c77dbd25ce017d5e6fb35d3407606e7a4180656a5a6a\",\n- \"sha256:cef128cb4d5e0b3493f058f10ce32365972c554572ff821e175dbc6f8ff6924f\",\n- \"sha256:cf16e3cf6c0a5fdd9bc10c21687e19d29ad1fe863372b5543deaec1039581a30\",\n- \"sha256:e56c744aa6ff427a607763346e4170629caf7e48ead6921745986db3692f987f\",\n- \"sha256:e577934fc5f8779c554639376beeaa5657d54349096ef24abe8c74c5d9c117c3\",\n- \"sha256:f2b0fa0c01d8a0c7483afd9f31d7ecf2d71760ca24499c8697aeb5ca37dc090c\"\n- ],\n- \"version\": \"==1.14.0\"\n- },\n- \"chardet\": {\n- \"hashes\": [\n- \"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae\",\n- \"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691\"\n- ],\n- \"version\": \"==3.0.4\"\n- },\n- \"click\": {\n- \"hashes\": [\n- \"sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc\",\n- \"sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a\"\n- ],\n- \"version\": \"==7.1.1\"\n- },\n- \"codecov\": {\n- \"hashes\": [\n- \"sha256:09fb045eb044a619cd2b9dacd7789ae8e322cb7f18196378579fd8d883e6b665\",\n- \"sha256:aeeefa3a03cac8a78e4f988e935b51a4689bb1f17f20d4e827807ee11135f845\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==2.0.22\"\n- },\n- \"configparser\": {\n- \"hashes\": [\n- \"sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c\",\n- \"sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df\"\n- ],\n- \"markers\": \"python_version < '3.2'\",\n- \"version\": \"==4.0.2\"\n- },\n- \"contextlib2\": {\n- \"hashes\": [\n- \"sha256:01f490098c18b19d2bd5bb5dc445b2054d2fa97f09a4280ba2c5f3c394c8162e\",\n- \"sha256:3355078a159fbb44ee60ea80abd0d87b80b78c248643b49aa6d94673b413609b\"\n- ],\n- \"markers\": \"python_version < '3.2'\",\n- \"version\": \"==0.6.0.post1\"\n- },\n- \"coverage\": {\n- \"hashes\": [\n- \"sha256:03f630aba2b9b0d69871c2e8d23a69b7fe94a1e2f5f10df5049c0df99db639a0\",\n- \"sha256:046a1a742e66d065d16fb564a26c2a15867f17695e7f3d358d7b1ad8a61bca30\",\n- \"sha256:0a907199566269e1cfa304325cc3b45c72ae341fbb3253ddde19fa820ded7a8b\",\n- \"sha256:165a48268bfb5a77e2d9dbb80de7ea917332a79c7adb747bd005b3a07ff8caf0\",\n- \"sha256:1b60a95fc995649464e0cd48cecc8288bac5f4198f21d04b8229dc4097d76823\",\n- \"sha256:1f66cf263ec77af5b8fe14ef14c5e46e2eb4a795ac495ad7c03adc72ae43fafe\",\n- \"sha256:2e08c32cbede4a29e2a701822291ae2bc9b5220a971bba9d1e7615312efd3037\",\n- \"sha256:3844c3dab800ca8536f75ae89f3cf566848a3eb2af4d9f7b1103b4f4f7a5dad6\",\n- \"sha256:408ce64078398b2ee2ec08199ea3fcf382828d2f8a19c5a5ba2946fe5ddc6c31\",\n- \"sha256:443be7602c790960b9514567917af538cac7807a7c0c0727c4d2bbd4014920fd\",\n- \"sha256:4482f69e0701139d0f2c44f3c395d1d1d37abd81bfafbf9b6efbe2542679d892\",\n- \"sha256:4a8a259bf990044351baf69d3b23e575699dd60b18460c71e81dc565f5819ac1\",\n- \"sha256:513e6526e0082c59a984448f4104c9bf346c2da9961779ede1fc458e8e8a1f78\",\n- \"sha256:5f587dfd83cb669933186661a351ad6fc7166273bc3e3a1531ec5c783d997aac\",\n- \"sha256:62061e87071497951155cbccee487980524d7abea647a1b2a6eb6b9647df9006\",\n- \"sha256:641e329e7f2c01531c45c687efcec8aeca2a78a4ff26d49184dce3d53fc35014\",\n- \"sha256:65a7e00c00472cd0f59ae09d2fb8a8aaae7f4a0cf54b2b74f3138d9f9ceb9cb2\",\n- \"sha256:6ad6ca45e9e92c05295f638e78cd42bfaaf8ee07878c9ed73e93190b26c125f7\",\n- \"sha256:73aa6e86034dad9f00f4bbf5a666a889d17d79db73bc5af04abd6c20a014d9c8\",\n- \"sha256:7c9762f80a25d8d0e4ab3cb1af5d9dffbddb3ee5d21c43e3474c84bf5ff941f7\",\n- \"sha256:85596aa5d9aac1bf39fe39d9fa1051b0f00823982a1de5766e35d495b4a36ca9\",\n- \"sha256:86a0ea78fd851b313b2e712266f663e13b6bc78c2fb260b079e8b67d970474b1\",\n- \"sha256:8a620767b8209f3446197c0e29ba895d75a1e272a36af0786ec70fe7834e4307\",\n- \"sha256:922fb9ef2c67c3ab20e22948dcfd783397e4c043a5c5fa5ff5e9df5529074b0a\",\n- \"sha256:9fad78c13e71546a76c2f8789623eec8e499f8d2d799f4b4547162ce0a4df435\",\n- \"sha256:a37c6233b28e5bc340054cf6170e7090a4e85069513320275a4dc929144dccf0\",\n- \"sha256:c3fc325ce4cbf902d05a80daa47b645d07e796a80682c1c5800d6ac5045193e5\",\n- \"sha256:cda33311cb9fb9323958a69499a667bd728a39a7aa4718d7622597a44c4f1441\",\n- \"sha256:db1d4e38c9b15be1521722e946ee24f6db95b189d1447fa9ff18dd16ba89f732\",\n- \"sha256:eda55e6e9ea258f5e4add23bcf33dc53b2c319e70806e180aecbff8d90ea24de\",\n- \"sha256:f372cdbb240e09ee855735b9d85e7f50730dcfb6296b74b95a3e5dea0615c4c1\"\n- ],\n- \"version\": \"==5.0.4\"\n- },\n- \"decorator\": {\n- \"hashes\": [\n- \"sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760\",\n- \"sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7\"\n- ],\n- \"version\": \"==4.4.2\"\n- },\n- \"detox\": {\n- \"hashes\": [\n- \"sha256:e650f95f0c7f5858578014b3b193e5dac76c89285c1bbe4bae598fd641bf9cd3\",\n- \"sha256:fcad009e2d20ce61176dc826a2c1562bd712fe53953ca603b455171cf819080f\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==0.19\"\n- },\n- \"distlib\": {\n- \"hashes\": [\n- \"sha256:2e166e231a26b36d6dfe35a48c4464346620f8645ed0ace01ee31822b288de21\"\n- ],\n- \"version\": \"==0.3.0\"\n- },\n- \"dnspython\": {\n- \"hashes\": [\n- \"sha256:36c5e8e38d4369a08b6780b7f27d790a292b2b08eea01607865bf0936c558e01\",\n- \"sha256:f69c21288a962f4da86e56c4905b49d11aba7938d3d740e80d9e366ee4f1632d\"\n- ],\n- \"version\": \"==1.16.0\"\n- },\n- \"docutils\": {\n- \"hashes\": [\n- \"sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af\",\n- \"sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==0.16\"\n- },\n- \"entrypoints\": {\n- \"hashes\": [\n- \"sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19\",\n- \"sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451\"\n- ],\n- \"version\": \"==0.3\"\n- },\n- \"enum34\": {\n- \"hashes\": [\n- \"sha256:a98a201d6de3f2ab3db284e70a33b0f896fbf35f8086594e8c9e74b909058d53\",\n- \"sha256:c3858660960c984d6ab0ebad691265180da2b43f07e061c0f8dca9ef3cffd328\",\n- \"sha256:cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248\"\n- ],\n- \"markers\": \"python_version == '2.7' or python_version == '3.3'\",\n- \"version\": \"==1.1.10\"\n- },\n- \"eventlet\": {\n- \"hashes\": [\n- \"sha256:658b1cd80937adc1a4860de2841e0528f64e2ca672885c4e00fc0e2217bde6b1\",\n- \"sha256:6c9c625af48424c4680d89314dbe45a76cc990cf002489f9469ff214b044ffc1\"\n- ],\n- \"version\": \"==0.25.1\"\n- },\n- \"execnet\": {\n- \"hashes\": [\n- \"sha256:cacb9df31c9680ec5f95553976c4da484d407e85e41c83cb812aa014f0eddc50\",\n- \"sha256:d4efd397930c46415f62f8a31388d6be4f27a91d7550eb79bc64a756e0056547\"\n- ],\n- \"version\": \"==1.7.1\"\n- },\n- \"filelock\": {\n- \"hashes\": [\n- \"sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59\",\n- \"sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836\"\n- ],\n- \"version\": \"==3.0.12\"\n- },\n- \"flake8\": {\n- \"hashes\": [\n- \"sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb\",\n- \"sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==3.7.9\"\n- },\n- \"flask\": {\n- \"hashes\": [\n- \"sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060\",\n- \"sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557\"\n- ],\n- \"version\": \"==1.1.2\"\n- },\n- \"funcsigs\": {\n- \"hashes\": [\n- \"sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca\",\n- \"sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50\"\n- ],\n- \"markers\": \"python_version < '3.0'\",\n- \"version\": \"==1.0.2\"\n- },\n- \"functools32\": {\n- \"hashes\": [\n- \"sha256:89d824aa6c358c421a234d7f9ee0bd75933a67c29588ce50aaa3acdf4d403fa0\",\n- \"sha256:f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d\"\n- ],\n- \"markers\": \"python_version < '3.2'\",\n- \"version\": \"==3.2.3.post2\"\n- },\n- \"greenlet\": {\n- \"hashes\": [\n- \"sha256:000546ad01e6389e98626c1367be58efa613fa82a1be98b0c6fc24b563acc6d0\",\n- \"sha256:0d48200bc50cbf498716712129eef819b1729339e34c3ae71656964dac907c28\",\n- \"sha256:23d12eacffa9d0f290c0fe0c4e81ba6d5f3a5b7ac3c30a5eaf0126bf4deda5c8\",\n- \"sha256:37c9ba82bd82eb6a23c2e5acc03055c0e45697253b2393c9a50cef76a3985304\",\n- \"sha256:51155342eb4d6058a0ffcd98a798fe6ba21195517da97e15fca3db12ab201e6e\",\n- \"sha256:51503524dd6f152ab4ad1fbd168fc6c30b5795e8c70be4410a64940b3abb55c0\",\n- \"sha256:7457d685158522df483196b16ec648b28f8e847861adb01a55d41134e7734122\",\n- \"sha256:8041e2de00e745c0e05a502d6e6db310db7faa7c979b3a5877123548a4c0b214\",\n- \"sha256:81fcd96a275209ef117e9ec91f75c731fa18dcfd9ffaa1c0adbdaa3616a86043\",\n- \"sha256:853da4f9563d982e4121fed8c92eea1a4594a2299037b3034c3c898cb8e933d6\",\n- \"sha256:8b4572c334593d449113f9dc8d19b93b7b271bdbe90ba7509eb178923327b625\",\n- \"sha256:9416443e219356e3c31f1f918a91badf2e37acf297e2fa13d24d1cc2380f8fbc\",\n- \"sha256:9854f612e1b59ec66804931df5add3b2d5ef0067748ea29dc60f0efdcda9a638\",\n- \"sha256:99a26afdb82ea83a265137a398f570402aa1f2b5dfb4ac3300c026931817b163\",\n- \"sha256:a19bf883b3384957e4a4a13e6bd1ae3d85ae87f4beb5957e35b0be287f12f4e4\",\n- \"sha256:a9f145660588187ff835c55a7d2ddf6abfc570c2651c276d3d4be8a2766db490\",\n- \"sha256:ac57fcdcfb0b73bb3203b58a14501abb7e5ff9ea5e2edfa06bb03035f0cff248\",\n- \"sha256:bcb530089ff24f6458a81ac3fa699e8c00194208a724b644ecc68422e1111939\",\n- \"sha256:beeabe25c3b704f7d56b573f7d2ff88fc99f0138e43480cecdfcaa3b87fe4f87\",\n- \"sha256:d634a7ea1fc3380ff96f9e44d8d22f38418c1c381d5fac680b272d7d90883720\",\n- \"sha256:d97b0661e1aead761f0ded3b769044bb00ed5d33e1ec865e891a8b128bf7c656\",\n- \"sha256:e538b8dae561080b542b0f5af64d47ef859f22517f7eca617bb314e0e03fd7ef\"\n- ],\n- \"version\": \"==0.4.15\"\n- },\n- \"httpbin\": {\n- \"hashes\": [\n- \"sha256:7a04b5904c80b7aa04dd0a6af6520d68ce17a5db175e66a64b971f8e93d73a26\",\n- \"sha256:cbb37790c91575f4f15757f42ad41d9f729eb227d5edbe89e4ec175486db8dfa\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==0.7.0\"\n- },\n- \"idna\": {\n- \"hashes\": [\n- \"sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb\",\n- \"sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa\"\n- ],\n- \"version\": \"==2.9\"\n- },\n- \"imagesize\": {\n- \"hashes\": [\n- \"sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1\",\n- \"sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1\"\n- ],\n- \"version\": \"==1.2.0\"\n- },\n- \"importlib-metadata\": {\n- \"hashes\": [\n- \"sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f\",\n- \"sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e\"\n- ],\n- \"markers\": \"python_version < '3.8'\",\n- \"version\": \"==1.6.0\"\n- },\n- \"importlib-resources\": {\n- \"hashes\": [\n- \"sha256:4019b6a9082d8ada9def02bece4a76b131518866790d58fdda0b5f8c603b36c2\",\n- \"sha256:dd98ceeef3f5ad2ef4cc287b8586da4ebad15877f351e9688987ad663a0a29b8\"\n- ],\n- \"markers\": \"python_version < '3.7'\",\n- \"version\": \"==1.4.0\"\n- },\n- \"itsdangerous\": {\n- \"hashes\": [\n- \"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19\",\n- \"sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749\"\n- ],\n- \"version\": \"==1.1.0\"\n- },\n- \"jinja2\": {\n- \"hashes\": [\n- \"sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250\",\n- \"sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49\"\n- ],\n- \"version\": \"==2.11.1\"\n- },\n- \"markupsafe\": {\n- \"hashes\": [\n- \"sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473\",\n- \"sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161\",\n- \"sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235\",\n- \"sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5\",\n- \"sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42\",\n- \"sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff\",\n- \"sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b\",\n- \"sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1\",\n- \"sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e\",\n- \"sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183\",\n- \"sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66\",\n- \"sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b\",\n- \"sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1\",\n- \"sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15\",\n- \"sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1\",\n- \"sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e\",\n- \"sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b\",\n- \"sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905\",\n- \"sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735\",\n- \"sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d\",\n- \"sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e\",\n- \"sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d\",\n- \"sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c\",\n- \"sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21\",\n- \"sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2\",\n- \"sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5\",\n- \"sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b\",\n- \"sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6\",\n- \"sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f\",\n- \"sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f\",\n- \"sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2\",\n- \"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7\",\n- \"sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be\"\n- ],\n- \"version\": \"==1.1.1\"\n- },\n- \"mccabe\": {\n- \"hashes\": [\n- \"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42\",\n- \"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f\"\n- ],\n- \"version\": \"==0.6.1\"\n- },\n- \"mock\": {\n- \"hashes\": [\n- \"sha256:83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3\",\n- \"sha256:d157e52d4e5b938c550f39eb2fd15610db062441a9c2747d3dbfa9298211d0f8\"\n- ],\n- \"markers\": \"python_version < '3.0'\",\n- \"version\": \"==3.0.5\"\n- },\n- \"monotonic\": {\n- \"hashes\": [\n- \"sha256:23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0\",\n- \"sha256:552a91f381532e33cbd07c6a2655a21908088962bb8fa7239ecbcc6ad1140cc7\"\n- ],\n- \"version\": \"==1.5\"\n- },\n- \"more-itertools\": {\n- \"hashes\": [\n- \"sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4\",\n- \"sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc\",\n- \"sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==5.0.0\"\n- },\n- \"pathlib2\": {\n- \"hashes\": [\n- \"sha256:0ec8205a157c80d7acc301c0b18fbd5d44fe655968f5d947b6ecef5290fc35db\",\n- \"sha256:6cd9a47b597b37cc57de1c05e56fb1a1c9cc9fab04fe78c29acd090418529868\"\n- ],\n- \"markers\": \"python_version < '3.6'\",\n- \"version\": \"==2.3.5\"\n- },\n- \"pluggy\": {\n- \"hashes\": [\n- \"sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0\",\n- \"sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d\"\n- ],\n- \"version\": \"==0.13.1\"\n- },\n- \"py\": {\n- \"hashes\": [\n- \"sha256:5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa\",\n- \"sha256:c20fdd83a5dbc0af9efd622bee9a5564e278f6380fffcacc43ba6f43db2813b0\"\n- ],\n- \"version\": \"==1.8.1\"\n- },\n- \"pycodestyle\": {\n- \"hashes\": [\n- \"sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56\",\n- \"sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c\"\n- ],\n- \"version\": \"==2.5.0\"\n- },\n- \"pycparser\": {\n- \"hashes\": [\n- \"sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0\",\n- \"sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705\"\n- ],\n- \"version\": \"==2.20\"\n- },\n- \"pyflakes\": {\n- \"hashes\": [\n- \"sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0\",\n- \"sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2\"\n- ],\n- \"version\": \"==2.1.1\"\n- },\n- \"pygments\": {\n- \"hashes\": [\n- \"sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b\",\n- \"sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe\"\n- ],\n- \"version\": \"==2.5.2\"\n- },\n- \"pysocks\": {\n- \"hashes\": [\n- \"sha256:08e69f092cc6dbe92a0fdd16eeb9b9ffbc13cadfe5ca4c7bd92ffb078b293299\",\n- \"sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5\",\n- \"sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0\"\n- ],\n- \"version\": \"==1.7.1\"\n- },\n- \"pytest\": {\n- \"hashes\": [\n- \"sha256:3f193df1cfe1d1609d4c583838bea3d532b18d6160fd3f55c9447fdca30848ec\",\n- \"sha256:e246cf173c01169b9617fc07264b7b1316e78d7a650055235d6d897bc80d9660\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==3.10.1\"\n- },\n- \"pytest-cov\": {\n- \"hashes\": [\n- \"sha256:cc6742d8bac45070217169f5f72ceee1e0e55b0221f54bcf24845972d3a47f2b\",\n- \"sha256:cdbdef4f870408ebdbfeb44e63e07eb18bb4619fae852f6e760645fa36172626\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==2.8.1\"\n- },\n- \"pytest-forked\": {\n- \"hashes\": [\n- \"sha256:1805699ed9c9e60cb7a8179b8d4fa2b8898098e82d229b0825d8095f0f261100\",\n- \"sha256:1ae25dba8ee2e56fb47311c9638f9e58552691da87e82d25b0ce0e4bf52b7d87\"\n- ],\n- \"version\": \"==1.1.3\"\n- },\n- \"pytest-httpbin\": {\n- \"hashes\": [\n- \"sha256:8cd57e27418a7d7d205fcc9802eea246ed06170e3065abfa76c6d9b40553592c\",\n- \"sha256:d3919c5df0b644454129c0066a8ae62db40ac54bacb4cfd89d8cfa58615a4b42\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==0.3.0\"\n- },\n- \"pytest-mock\": {\n- \"hashes\": [\n- \"sha256:b35eb281e93aafed138db25c8772b95d3756108b601947f89af503f8c629413f\",\n- \"sha256:cb67402d87d5f53c579263d37971a164743dc33c159dfb4fb4a86f37c5552307\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==2.0.0\"\n- },\n- \"pytest-xdist\": {\n- \"hashes\": [\n- \"sha256:96f893094c89fddeaff3f4783f4807f7aeb138be1a0d87a8805057b6af1201b5\",\n- \"sha256:aab1402f2b063df48bf044b042707610f8fcc4c49d0eb9c10e79e30b3f26074f\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==1.25.0\"\n- },\n- \"pytz\": {\n- \"hashes\": [\n- \"sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d\",\n- \"sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be\"\n- ],\n- \"version\": \"==2019.3\"\n- },\n- \"raven\": {\n- \"extras\": [\n- \"flask\"\n- ],\n- \"hashes\": [\n- \"sha256:3fa6de6efa2493a7c827472e984ce9b020797d0da16f1db67197bcc23c8fae54\",\n- \"sha256:44a13f87670836e153951af9a3c80405d36b43097db869a36e92809673692ce4\"\n- ],\n- \"version\": \"==6.10.0\"\n- },\n- \"readme-renderer\": {\n- \"hashes\": [\n- \"sha256:1b6d8dd1673a0b293766b4106af766b6eff3654605f9c4f239e65de6076bc222\",\n- \"sha256:e67d64242f0174a63c3b727801a2fff4c1f38ebe5d71d95ff7ece081945a6cd4\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==25.0\"\n- },\n- \"requests\": {\n- \"editable\": true,\n- \"extras\": [\n- \"socks\"\n- ],\n- \"path\": \".\"\n- },\n- \"scandir\": {\n- \"hashes\": [\n- \"sha256:2586c94e907d99617887daed6c1d102b5ca28f1085f90446554abf1faf73123e\",\n- \"sha256:2ae41f43797ca0c11591c0c35f2f5875fa99f8797cb1a1fd440497ec0ae4b022\",\n- \"sha256:2b8e3888b11abb2217a32af0766bc06b65cc4a928d8727828ee68af5a967fa6f\",\n- \"sha256:2c712840c2e2ee8dfaf36034080108d30060d759c7b73a01a52251cc8989f11f\",\n- \"sha256:4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae\",\n- \"sha256:67f15b6f83e6507fdc6fca22fedf6ef8b334b399ca27c6b568cbfaa82a364173\",\n- \"sha256:7d2d7a06a252764061a020407b997dd036f7bd6a175a5ba2b345f0a357f0b3f4\",\n- \"sha256:8c5922863e44ffc00c5c693190648daa6d15e7c1207ed02d6f46a8dcc2869d32\",\n- \"sha256:92c85ac42f41ffdc35b6da57ed991575bdbe69db895507af88b9f499b701c188\",\n- \"sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d\",\n- \"sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac\"\n- ],\n- \"markers\": \"python_version < '3.5'\",\n- \"version\": \"==1.10.0\"\n- },\n- \"singledispatch\": {\n- \"hashes\": [\n- \"sha256:5b06af87df13818d14f08a028e42f566640aef80805c3b50c5056b086e3c2b9c\",\n- \"sha256:833b46966687b3de7f438c761ac475213e53b306740f1abfaa86e1d1aae56aa8\"\n- ],\n- \"markers\": \"python_version < '3.4'\",\n- \"version\": \"==3.4.0.3\"\n- },\n- \"six\": {\n- \"hashes\": [\n- \"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a\",\n- \"sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c\"\n- ],\n- \"version\": \"==1.14.0\"\n- },\n- \"snowballstemmer\": {\n- \"hashes\": [\n- \"sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0\",\n- \"sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52\"\n- ],\n- \"version\": \"==2.0.0\"\n- },\n- \"sphinx\": {\n- \"hashes\": [\n- \"sha256:11f271e7a9398385ed730e90f0bb41dc3815294bdcd395b46ed2d033bc2e7d87\",\n- \"sha256:4064ea6c56feeb268838cb8fbbee507d0c3d5d92fa63a7df935a916b52c9e2f5\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==1.5.5\"\n- },\n- \"toml\": {\n- \"hashes\": [\n- \"sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c\",\n- \"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e\"\n- ],\n- \"version\": \"==0.10.0\"\n- },\n- \"tox\": {\n- \"hashes\": [\n- \"sha256:2a8d8a63660563e41e64e3b5b677e81ce1ffa5e2a93c2c565d3768c287445800\",\n- \"sha256:edfca7809925f49bdc110d0a2d9966bbf35a0c25637216d9586e7a5c5de17bfb\"\n- ],\n- \"index\": \"pypi\",\n- \"version\": \"==3.6.1\"\n- },\n- \"typing\": {\n- \"hashes\": [\n- \"sha256:91dfe6f3f706ee8cc32d38edbbf304e9b7583fb37108fef38229617f8b3eba23\",\n- \"sha256:c8cabb5ab8945cd2f54917be357d134db9cc1eb039e59d1606dc1e60cb1d9d36\",\n- \"sha256:f38d83c5a7a7086543a0f649564d661859c5146a85775ab90c0d2f93ffaa9714\"\n- ],\n- \"markers\": \"python_version < '3.5'\",\n- \"version\": \"==3.7.4.1\"\n- },\n- \"urllib3\": {\n- \"hashes\": [\n- \"sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc\",\n- \"sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc\"\n- ],\n- \"version\": \"==1.25.8\"\n- },\n- \"virtualenv\": {\n- \"hashes\": [\n- \"sha256:4e399f48c6b71228bf79f5febd27e3bbb753d9d5905776a86667bc61ab628a25\",\n- \"sha256:9e81279f4a9d16d1c0654a127c2c86e5bca2073585341691882c1e66e31ef8a5\"\n- ],\n- \"version\": \"==20.0.15\"\n- },\n- \"webencodings\": {\n- \"hashes\": [\n- \"sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78\",\n- \"sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923\"\n- ],\n- \"version\": \"==0.5.1\"\n- },\n- \"werkzeug\": {\n- \"hashes\": [\n- \"sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43\",\n- \"sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c\"\n- ],\n- \"version\": \"==1.0.1\"\n- },\n- \"zipp\": {\n- \"hashes\": [\n- \"sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1\",\n- \"sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921\"\n- ],\n- \"markers\": \"python_version < '3.8'\",\n- \"version\": \"==1.2.0\"\n- }\n- }\n-}"
+ },
+ {
+ "filename": "_appveyor/install.ps1",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 229,
+ "changes": 229,
+ "patch": "@@ -1,229 +0,0 @@\n-# Sample script to install Python and pip under Windows\n-# Authors: [NAME_REDACTED], [NAME_REDACTED], [NAME_REDACTED], and [NAME_REDACTED]\n-# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/\n-\n-$MINICONDA_URL = \"http://repo.continuum.io/miniconda/\"\n-$BASE_URL = \"https://www.python.org/ftp/python/\"\n-$GET_PIP_URL = \"https://bootstrap.pypa.io/get-pip.py\"\n-$GET_PIP_PATH = \"C:\\get-pip.py\"\n-\n-$PYTHON_PRERELEASE_REGEX = @\"\n-(?x)\n-(?\\d+)\n-\\.\n-(?\\d+)\n-\\.\n-(?\\d+)\n-(?[a-z]{1,2}\\d+)\n-\"@\n-\n-\n-function Download ($filename, $url) {\n- $webclient = [NAME_REDACTED]\n-\n- $basedir = $pwd.Path + \"\\\"\n- $filepath = $basedir + $filename\n- if (Test-Path $filename) {\n- Write-Host \"Reusing\" $filepath\n- return $filepath\n- }\n-\n- # Download and retry up to 3 times in case of network transient errors.\n- Write-Host \"Downloading\" $filename \"from\" $url\n- $retry_attempts = 2\n- for ($i = 0; $i -lt $retry_attempts; $i++) {\n- try {\n- $webclient.DownloadFile($url, $filepath)\n- break\n- }\n- Catch [Exception]{\n- Start-Sleep 1\n- }\n- }\n- if (Test-Path $filepath) {\n- Write-Host \"File saved at\" $filepath\n- } else {\n- # Retry once to get the error message if any at the last try\n- $webclient.DownloadFile($url, $filepath)\n- }\n- return $filepath\n-}\n-\n-\n-function ParsePythonVersion ($python_version) {\n- if ($python_version -match $PYTHON_PRERELEASE_REGEX) {\n- return ([int]$matches.major, [int]$matches.minor, [int]$matches.micro,\n- $matches.prerelease)\n- }\n- $version_obj = [version]$python_version\n- return ($version_obj.major, $version_obj.minor, $version_obj.build, \"\")\n-}\n-\n-\n-function DownloadPython ($python_version, $platform_suffix) {\n- $major, $minor, $micro, $prerelease = ParsePythonVersion $python_version\n-\n- if (($major -le 2 -and $micro -eq 0) `\n- -or ($major -eq 3 -and $minor -le 2 -and $micro -eq 0) `\n- ) {\n- $dir = \"$major.$minor\"\n- $python_version = \"$major.$minor$prerelease\"\n- } else {\n- $dir = \"$major.$minor.$micro\"\n- }\n-\n- if ($prerelease) {\n- if (($major -le 2) `\n- -or ($major -eq 3 -and $minor -eq 1) `\n- -or ($major -eq 3 -and $minor -eq 2) `\n- -or ($major -eq 3 -and $minor -eq 3) `\n- ) {\n- $dir = \"$dir/prev\"\n- }\n- }\n-\n- if (($major -le 2) -or ($major -le 3 -and $minor -le 4)) {\n- $ext = \"msi\"\n- if ($platform_suffix) {\n- $platform_suffix = \".$platform_suffix\"\n- }\n- } else {\n- $ext = \"exe\"\n- if ($platform_suffix) {\n- $platform_suffix = \"-$platform_suffix\"\n- }\n- }\n-\n- $filename = \"python-$python_version$platform_suffix.$ext\"\n- $url = \"$BASE_URL$dir/$filename\"\n- $filepath = Download $filename $url\n- return $filepath\n-}\n-\n-\n-function InstallPython ($python_version, $architecture, $python_home) {\n- Write-Host \"[NAME_REDACTED]\" $python_version \"for\" $architecture \"bit architecture to\" $python_home\n- if (Test-Path $python_home) {\n- Write-Host $python_home \"already exists, skipping.\"\n- return $false\n- }\n- if ($architecture -eq \"32\") {\n- $platform_suffix = \"\"\n- } else {\n- $platform_suffix = \"amd64\"\n- }\n- $installer_path = DownloadPython $python_version $platform_suffix\n- $installer_ext = [System.IO.Path]::GetExtension($installer_path)\n- Write-Host \"Installing $installer_path to $python_home\"\n- $install_log = $python_home + \".log\"\n- if ($installer_ext -eq '.msi') {\n- InstallPythonMSI $installer_path $python_home $install_log\n- } else {\n- InstallPythonEXE $installer_path $python_home $install_log\n- }\n- if (Test-Path $python_home) {\n- Write-Host \"Python $python_version ($architecture) installation complete\"\n- } else {\n- Write-Host \"Failed to install Python in $python_home\"\n- Get-Content -Path $install_log\n- Exit 1\n- }\n-}\n-\n-\n-function InstallPythonEXE ($exepath, $python_home, $install_log) {\n- $install_args = \"/quiet InstallAllUsers=1 TargetDir=$python_home\"\n- RunCommand $exepath $install_args\n-}\n-\n-\n-function InstallPythonMSI ($msipath, $python_home, $install_log) {\n- $install_args = \"/qn /log $install_log /i $msipath TARGETDIR=$python_home\"\n- $uninstall_args = \"/qn /x $msipath\"\n- RunCommand \"msiexec.exe\" $install_args\n- if (-not(Test-Path $python_home)) {\n- Write-Host \"Python seems to be installed else-where, reinstalling.\"\n- RunCommand \"msiexec.exe\" $uninstall_args\n- RunCommand \"msiexec.exe\" $install_args\n- }\n-}\n-\n-function RunCommand ($command, $command_args) {\n- Write-Host $command $command_args\n- Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru\n-}\n-\n-\n-function InstallPip ($python_home) {\n- $pip_path = $python_home + \"\\Scripts\\pip.exe\"\n- $python_path = $python_home + \"\\python.exe\"\n- if (-not(Test-Path $pip_path)) {\n- Write-Host \"Installing pip...\"\n- $webclient = [NAME_REDACTED]\n- $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)\n- Write-Host \"Executing:\" $python_path $GET_PIP_PATH\n- & $python_path $GET_PIP_PATH\n- } else {\n- Write-Host \"pip already installed.\"\n- }\n-}\n-\n-\n-function DownloadMiniconda ($python_version, $platform_suffix) {\n- if ($python_version -eq \"3.4\") {\n- $filename = \"Miniconda3-3.5.5-Windows-\" + $platform_suffix + \".exe\"\n- } else {\n- $filename = \"Miniconda-3.5.5-Windows-\" + $platform_suffix + \".exe\"\n- }\n- $url = $MINICONDA_URL + $filename\n- $filepath = Download $filename $url\n- return $filepath\n-}\n-\n-\n-function InstallMiniconda ($python_version, $architecture, $python_home) {\n- Write-Host \"[NAME_REDACTED]\" $python_version \"for\" $architecture \"bit architecture to\" $python_home\n- if (Test-Path $python_home) {\n- Write-Host $python_home \"already exists, skipping.\"\n- return $false\n- }\n- if ($architecture -eq \"32\") {\n- $platform_suffix = \"x86\"\n- } else {\n- $platform_suffix = \"x86_64\"\n- }\n- $filepath = DownloadMiniconda $python_version $platform_suffix\n- Write-Host \"Installing\" $filepath \"to\" $python_home\n- $install_log = $python_home + \".log\"\n- $args = \"/S /D=$python_home\"\n- Write-Host $filepath $args\n- Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru\n- if (Test-Path $python_home) {\n- Write-Host \"Python $python_version ($architecture) installation complete\"\n- } else {\n- Write-Host \"Failed to install Python in $python_home\"\n- Get-Content -Path $install_log\n- Exit 1\n- }\n-}\n-\n-\n-function InstallMinicondaPip ($python_home) {\n- $pip_path = $python_home + \"\\Scripts\\pip.exe\"\n- $conda_path = $python_home + \"\\Scripts\\conda.exe\"\n- if (-not(Test-Path $pip_path)) {\n- Write-Host \"Installing pip...\"\n- $args = \"install --yes pip\"\n- Write-Host $conda_path $args\n- Start-Process -FilePath \"$conda_path\" -ArgumentList $args -Wait -Passthru\n- } else {\n- Write-Host \"pip already installed.\"\n- }\n-}\n-\n-function main () {\n- InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON\n- InstallPip $env:PYTHON\n-}\n-\n-main"
+ },
+ {
+ "filename": "appveyor.yml",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 62,
+ "changes": 62,
+ "patch": "@@ -1,62 +0,0 @@\n-# AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo\n-# License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/\n-\n-build: off\n-\n-environment:\n- matrix:\n- - PYTHON: \"C:\\\\Python27-x64\"\n- PYTHON_VERSION: \"2.7.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py27\"\n-\n- - PYTHON: \"C:\\\\Python34-x64\"\n- PYTHON_VERSION: \"3.4.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py34\"\n-\n- - PYTHON: \"C:\\\\Python35-x64\"\n- PYTHON_VERSION: \"3.5.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py35\"\n-\n- - PYTHON: \"C:\\\\Python36-x64\"\n- PYTHON_VERSION: \"3.6.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py36\"\n-\n- - PYTHON: \"C:\\\\Python37-x64\"\n- PYTHON_VERSION: \"3.7.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py37\"\n-\n- - PYTHON: \"C:\\\\Python38-x64\"\n- PYTHON_VERSION: \"3.8.x\"\n- PYTHON_ARCH: \"64\"\n- TOXENV: \"py38\"\n-\n-install:\n- # [NAME_REDACTED] (from the official .msi of https://www.python.org/) and pip when\n- # not already installed.\n- - ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\\install.ps1 }\n-\n- # Prepend newly installed Python to the PATH of this build (this cannot be\n- # done from inside the powershell script as it would require to restart\n- # the parent CMD process).\n- - \"SET PATH=%PYTHON%;%PYTHON%\\\\Scripts;%PATH%\"\n-\n- # Check that we have the expected version and architecture for Python\n- - \"python --version\"\n- - \"python -c \\\"import struct; print(struct.calcsize('P') * 8)\\\"\"\n-\n- # Upgrade to the latest version of pip to avoid it displaying warnings\n- # about it being out of date.\n- - \"python -m pip install --upgrade pip wheel\"\n- - \"C:\\\\MinGW\\\\bin\\\\mingw32-make\"\n- - \"pipenv install -e .[socks] --skip-lock\"\n-\n-test_script:\n- - \"C:\\\\MinGW\\\\bin\\\\mingw32-make coverage\"\n-\n-on_success:\n- - \"pipenv run codecov -f coverage.xml\""
+ },
+ {
+ "filename": "requirements-dev.txt",
+ "status": "added",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -0,0 +1,6 @@\n+pytest>=2.8.0,<=3.10.1\n+pytest-cov\n+pytest-httpbin<1.0\n+pytest-mock==2.0.0\n+httpbin==0.7.0\n+wheel"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -668,7 +668,7 @@ def test_POSTBIN_GET_POST_FILES(self, httpbin):\n post1 = requests.post(url, data={'some': 'data'})\n assert post1.status_code == 200\n \n- with open('Pipfile') as f:\n+ with open('requirements-dev.txt') as f:\n post2 = requests.post(url, files={'some': f})\n assert post2.status_code == 200\n \n@@ -736,7 +736,7 @@ def test_POSTBIN_GET_POST_FILES_WITH_DATA(self, httpbin):\n post1 = requests.post(url, data={'some': 'data'})\n assert post1.status_code == 200\n \n- with open('Pipfile') as f:\n+ with open('requirements-dev.txt') as f:\n post2 = requests.post(url, data={'some': 'data'}, files={'some': f})\n assert post2.status_code == 200\n \n@@ -773,7 +773,7 @@ def __len__(self):\n \n def test_conflicting_post_params(self, httpbin):\n url = httpbin('post')\n- with open('Pipfile') as f:\n+ with open('requirements-dev.txt') as f:\n with pytest.raises(ValueError):\n requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})\n with pytest.raises(ValueError):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 527710359,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-11T00:17:46+00:00"
+ },
+ {
+ "id": 527772501,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-11T01:10:24+00:00"
+ },
+ {
+ "id": 528426254,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-11-11T18:21:54+00:00"
+ },
+ {
+ "id": 528427437,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "Woo, excited to see the Pipfile go, that means we don't have to maintain our own dependencies on the urllib3 downstream tests!",
+ "submitted_at": "2020-11-11T18:23:35+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 520956859,
+ "user": "user_0fa58b6f3572",
+ "body": "Since we're (rightfully) dropping pipenv, should we get rid of the rest of its cruft (Pipenv, Pipenv.lock)?",
+ "path": "Makefile",
+ "line": 9,
+ "side": "RIGHT",
+ "created_at": "2020-11-11T00:17:46+00:00"
+ },
+ {
+ "id": 520981915,
+ "user": "user_dbf2a999bd6d",
+ "body": "~I'd been thinking we'd do that in the next minor release. Pipenv has \\~1M downloads a month, but I have no idea if anyone even uses the [NAME_REDACTED]. I'm not tied to waiting if you or Seth feel strongly.~\nI tested pipenv when we remove the Pipfile and it actually degrades pretty gracefully. Let's just remove it now.",
+ "path": "Makefile",
+ "line": 9,
+ "side": "RIGHT",
+ "created_at": "2020-11-11T01:10:24+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "in",
+ "lock",
+ "ps1",
+ "py",
+ "txt",
+ "yml"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "c27c3f1ff87afc08",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.472836+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5643,
+ "title": "Respect the NETRC environment variable",
+ "body": "Resurecting https://github.com/psf/requests/pull/4339 with incorporated review/feedback\n\nFixes https://github.com/psf/requests/issues/4318",
+ "author": "user_42c44b61b198",
+ "created_at": "2020-10-30T17:20:32+00:00",
+ "merged_at": "2020-11-01T16:52:02+00:00",
+ "base_branch": "master",
+ "head_branch": "netrc",
+ "additions": 10,
+ "deletions": 3,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -213,7 +213,8 @@ Note: Custom headers are given less precedence than more specific sources of inf\n \n * Authorization headers set with `headers=` will be overridden if credentials\n are specified in ``.netrc``, which in turn will be overridden by the ``auth=``\n- parameter.\n+ parameter. Requests will search for the netrc file at `~/.netrc`, `~/_netrc`,\n+ or at the path specified by the `NETRC` environment variable.\n * Authorization headers will be removed if you get redirected off-host.\n * Proxy-Authorization headers will be overridden by [NAME_REDACTED] the URL.\n * Content-Length headers will be overridden when we can determine the length of the content."
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 2,
+ "changes": 10,
+ "patch": "@@ -169,14 +169,20 @@ def super_len(o):\n def get_netrc_auth(url, raise_errors=False):\n \"\"\"Returns the Requests tuple auth for a given url from netrc.\"\"\"\n \n+ netrc_file = os.environ.get('NETRC')\n+ if netrc_file is not None:\n+ netrc_locations = (netrc_file,)\n+ else:\n+ netrc_locations = ('~/{}'.format(f) for f in NETRC_FILES)\n+\n try:\n from netrc import netrc, NetrcParseError\n \n netrc_path = None\n \n- for f in NETRC_FILES:\n+ for f in netrc_locations:\n try:\n- loc = os.path.expanduser('~/{}'.format(f))\n+ loc = os.path.expanduser(f)\n except KeyError:\n # os.path.expanduser can fail when $HOME is undefined and\n # getpwuid fails. See https://bugs.python.org/issue20164 &"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 520925065,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-30T18:16:11+00:00"
+ },
+ {
+ "id": 520939299,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-30T18:37:49+00:00"
+ },
+ {
+ "id": 520951868,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-30T18:57:26+00:00"
+ },
+ {
+ "id": 520952577,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-30T18:58:35+00:00"
+ },
+ {
+ "id": 521148615,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-31T15:46:27+00:00"
+ },
+ {
+ "id": 521148634,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2020-10-31T15:46:49+00:00"
+ },
+ {
+ "id": 521189533,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": "Yeah, I think I'm fine with adding support. Left a quick question about the current implementation.",
+ "submitted_at": "2020-11-01T03:30:40+00:00"
+ },
+ {
+ "id": 521189789,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T03:37:52+00:00"
+ },
+ {
+ "id": 521189969,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T03:43:20+00:00"
+ },
+ {
+ "id": 521190054,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T03:46:02+00:00"
+ },
+ {
+ "id": 521190344,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T03:54:57+00:00"
+ },
+ {
+ "id": 521190468,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T03:58:09+00:00"
+ },
+ {
+ "id": 521190637,
+ "user": "user_42c44b61b198",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-01T04:02:31+00:00"
+ },
+ {
+ "id": 521238976,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-11-01T16:20:31+00:00"
+ },
+ {
+ "id": 521241413,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Great, this looks good to me. Thanks [USER_REDACTED]!",
+ "submitted_at": "2020-11-01T16:51:50+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 515293992,
+ "user": "user_0fa58b6f3572",
+ "body": "Why are you duplicating `.eggs` here? And `.tox` below?",
+ "path": ".gitignore",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-30T18:16:10+00:00"
+ },
+ {
+ "id": 515304726,
+ "user": "user_42c44b61b198",
+ "body": "ah jeez, let me fix that...",
+ "path": ".gitignore",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-30T18:37:49+00:00"
+ },
+ {
+ "id": 515314229,
+ "user": "user_42c44b61b198",
+ "body": "hrm, I amended the commit and force-pushed on my fork, but this change is still showing up...",
+ "path": ".gitignore",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-30T18:57:26+00:00"
+ },
+ {
+ "id": 515314732,
+ "user": "user_42c44b61b198",
+ "body": "ok here goes.",
+ "path": ".gitignore",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-30T18:58:35+00:00"
+ },
+ {
+ "id": 515509645,
+ "user": "user_0fa58b6f3572",
+ "body": "GitHub does that to avoid confusing folks with \"I left feedback here! They force-pushed and now it's disappeared!\"",
+ "path": ".gitignore",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-31T15:46:27+00:00"
+ },
+ {
+ "id": 515570061,
+ "user": "user_dbf2a999bd6d",
+ "body": "This doesn't look quite right. Are all `NETRC` paths relative to the users home directory? I think we only want this formatting for the `NETRC_FILES`.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:29:19+00:00"
+ },
+ {
+ "id": 515570584,
+ "user": "user_dbf2a999bd6d",
+ "body": "Actually, it looks like the last PR has [similar feedback](https://github.com/psf/requests/pull/4339#discussion_r144723124). If we can get that or something similar incorporated, I think we're set.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:37:52+00:00"
+ },
+ {
+ "id": 515570915,
+ "user": "user_42c44b61b198",
+ "body": "very true... how's this then?",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:43:20+00:00"
+ },
+ {
+ "id": 515571119,
+ "user": "user_42c44b61b198",
+ "body": "I can also do it exactly as suggested in previous PR... let me know",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:46:02+00:00"
+ },
+ {
+ "id": 515571702,
+ "user": "user_dbf2a999bd6d",
+ "body": "I'm a little hesitant to mutate this directly with how long it's been around. Let's keep the formatting inside `get_netrc_auth` if possible.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:54:57+00:00"
+ },
+ {
+ "id": 515571919,
+ "user": "user_42c44b61b198",
+ "body": "ah makes total sense, wouldn't have thought of that... changing then!",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T03:58:09+00:00"
+ },
+ {
+ "id": 515572244,
+ "user": "user_42c44b61b198",
+ "body": "done.",
+ "path": "requests/utils.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-01T04:02:31+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 12,
+ "DISMISSED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 11,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 12
+ }
+}
+{
+ "_id": "0316b7cdad910c52",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.472836+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5611,
+ "title": "Create codeql-analysis.yml",
+ "body": null,
+ "author": "user_0fa58b6f3572",
+ "created_at": "2020-10-01T14:19:41+00:00",
+ "merged_at": "2020-10-02T22:10:53+00:00",
+ "base_branch": "master",
+ "head_branch": "add-codescanning",
+ "additions": 66,
+ "deletions": 0,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": ".github/workflows/codeql-analysis.yml",
+ "status": "added",
+ "additions": 66,
+ "deletions": 0,
+ "changes": 66,
+ "patch": "@@ -0,0 +1,66 @@\n+# For most projects, this workflow file will not need changing; you simply need\n+# to commit it to your repository.\n+#\n+# You may wish to alter this file to override the set of languages analyzed,\n+# or to provide custom queries or build logic.\n+name: \"CodeQL\"\n+\n+on:\n+ push:\n+ branches: [master]\n+ pull_request:\n+ # The branches below must be a subset of the branches above\n+ branches: [master]\n+ schedule:\n+ - cron: '0 23 * * 0'\n+\n+jobs:\n+ analyze:\n+ name: Analyze\n+ runs-on: ubuntu-latest\n+\n+ strategy:\n+ fail-fast: false\n+\n+\n+ steps:\n+ - name: Checkout repository\n+ uses: actions/checkout@v2\n+ with:\n+ # We must fetch at least the immediate parents so that if this is\n+ # a pull request then we can checkout the head.\n+ fetch-depth: 2\n+\n+ # If this run was triggered by a pull request event, then checkout\n+ # the head of the pull request instead of the merge commit.\n+ - run: git checkout HEAD^2\n+ if: ${{ github.event_name == 'pull_request' }}\n+\n+ # Initializes the CodeQL tools for scanning.\n+ - name: [NAME_REDACTED]\n+ uses: github/codeql-action/init@v1\n+ with:\n+ languages: \"python\"\n+ # If you wish to specify custom queries, you can do so here or in a config file.\n+ # By default, queries listed here will override any specified in a config file. \n+ # Prefix the list here with \"+\" to use these queries and those in the config file.\n+ # queries: ./path/to/local/query, your-org/your-repo/queries@main\n+\n+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).\n+ # If this step fails, then you should remove it and run the build manually (see below)\n+ - name: Autobuild\n+ uses: github/codeql-action/autobuild@v1\n+\n+ # ℹ️ Command-line programs to run using the OS shell.\n+ # 📚 https://git.io/JvXDl\n+\n+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines\n+ # and modify them (or add more) to build your code if your project\n+ # uses a compiled language\n+\n+ #- run: |\n+ # make bootstrap\n+ # make release\n+\n+ - name: [NAME_REDACTED]\n+ uses: github/codeql-action/analyze@v1"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 500492666,
+ "user": "user_b08fb5f52ea1",
+ "state": "CHANGES_REQUESTED",
+ "body": "Interesting service! Some of the comments in the yml are a little much, up to you if you want to prune them down a bit.\n\nAlso, if this makes security vulnerabilities public have we tried running it locally and fixed issues before making this automated?",
+ "submitted_at": "2020-10-01T15:55:50+00:00"
+ },
+ {
+ "id": 501379200,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-02T19:03:00+00:00"
+ },
+ {
+ "id": 501381530,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-02T19:06:45+00:00"
+ },
+ {
+ "id": 501381619,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-02T19:06:54+00:00"
+ },
+ {
+ "id": 501385321,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-02T19:13:05+00:00"
+ },
+ {
+ "id": 501398380,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-10-02T19:35:44+00:00"
+ },
+ {
+ "id": 501418075,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "LGTM",
+ "submitted_at": "2020-10-02T20:10:30+00:00"
+ },
+ {
+ "id": 501449244,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-10-02T21:09:06+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 498351730,
+ "user": "user_b08fb5f52ea1",
+ "body": "Can we hard-code `python` here and not use the matrix feature?",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-01T15:54:18+00:00"
+ },
+ {
+ "id": 498352098,
+ "user": "user_b08fb5f52ea1",
+ "body": "Is there value in checking the v3 branch if it's likely not going to be released?",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-01T15:54:52+00:00"
+ },
+ {
+ "id": 499000189,
+ "user": "user_0fa58b6f3572",
+ "body": "Better question: Is there value in keeping it around if it's not going to be released?",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-02T19:03:00+00:00"
+ },
+ {
+ "id": 499001826,
+ "user": "user_0fa58b6f3572",
+ "body": "Done",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-02T19:06:44+00:00"
+ },
+ {
+ "id": 499001880,
+ "user": "user_0fa58b6f3572",
+ "body": "Removed it in the second commit as well",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-02T19:06:53+00:00"
+ },
+ {
+ "id": 499004453,
+ "user": "user_dbf2a999bd6d",
+ "body": "I think there's a lot of valuable work on the proposed/3.0.0 branch that *could* be released at some point. I was keeping it up to date until we had some of the crazier commit history changes in 2018. I think we can get it back in sync but it's going to take a pretty tedious merge. Alternatively, we could hand pick the relevant feature commits, but that's also a big time investment.\n\nThat said, I don't think there's any value in checking the current proposal branch here.",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-02T19:13:05+00:00"
+ },
+ {
+ "id": 499014113,
+ "user": "user_0fa58b6f3572",
+ "body": "Frankly, I think there's a lot of internal refactoring that could make a 3.0 easier to release and maintain long-term. It's something I've thought about for over a year",
+ "path": ".github/workflows/codeql-analysis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-10-02T19:35:44+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 5,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 6,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 7
+ }
+}
+{
+ "_id": "c4db515bbb83d1e7",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.472836+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5443,
+ "title": "Don't use pyOpenSSL unless no SNI is detected",
+ "body": "This is part 1 on removing `requests[security]` extra, for now we can still support SNI-less installations of Python but instead of unconditional monkey-patching we only patch if we detect either no `ssl` module or no `SNI` support.\n\nRelated: https://github.com/psf/requests/issues/5267\ncc [USER_REDACTED] \n\nAn additional thought I had was if we wanted to warn users about the complete removal of `requests[security]` I don't think there's a way to detect if you were installed via `requests pyopenssl` or `requests[security]` beyond registering a name on PyPI like `requests-security-extra`, trying to import it, and if we do then we know we were installed via `requests[security]` so throw a deprecation warning? Otherwise our \"end-goal\" could be to have `requests[security]` be empty?",
+ "author": "user_b08fb5f52ea1",
+ "created_at": "2020-04-30T13:57:50+00:00",
+ "merged_at": "2020-05-01T23:33:52+00:00",
+ "base_branch": "master",
+ "head_branch": "remove-pyopenssl-default",
+ "additions": 21,
+ "deletions": 8,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 2,
+ "changes": 9,
+ "patch": "@@ -4,9 +4,14 @@ Release History\n dev\n ---\n \n-**Bugfixes**\n+**Improvements**\n+\n+- pyOpenSSL TLS implementation is now only used if Python\n+ either doesn't have an `ssl` module or doesn't support\n+ SNI. Previously pyOpenSSL was unconditionally used if available.\n+ This applies even if pyOpenSSL is installed via the\n+ `requests[security]` extra (#5443)\n \n-- \\[Short description of non-trivial change.\\]\n \n 2.23.0 (2020-02-19)\n -------------------"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 6,
+ "changes": 20,
+ "patch": "@@ -90,14 +90,22 @@ def _check_cryptography(cryptography_version):\n \"version!\".format(urllib3.__version__, chardet.__version__),\n RequestsDependencyWarning)\n \n-# Attempt to enable urllib3's SNI support, if possible\n+# Attempt to enable urllib3's fallback for SNI support\n+# if the standard library doesn't support SNI or the\n+# 'ssl' library isn't available.\n try:\n- from urllib3.contrib import pyopenssl\n- pyopenssl.inject_into_urllib3()\n+ try:\n+ import ssl\n+ except ImportError:\n+ ssl = None\n+\n+ if not getattr(ssl, \"HAS_SNI\", False):\n+ from urllib3.contrib import pyopenssl\n+ pyopenssl.inject_into_urllib3()\n \n- # Check cryptography version\n- from cryptography import __version__ as cryptography_version\n- _check_cryptography(cryptography_version)\n+ # Check cryptography version\n+ from cryptography import __version__ as cryptography_version\n+ _check_cryptography(cryptography_version)\n except ImportError:\n pass"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 404117261,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": "One question but otherwise LGTM",
+ "submitted_at": "2020-05-01T11:17:02+00:00"
+ },
+ {
+ "id": 404146423,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-05-01T12:59:03+00:00"
+ },
+ {
+ "id": 404436373,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": "Ok cool, it sounds like we’ve got agreement this is a decent compromise to at least get us moving in the right direction.",
+ "submitted_at": "2020-05-01T22:46:57+00:00"
+ },
+ {
+ "id": 404446873,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Perfect 👌",
+ "submitted_at": "2020-05-01T23:31:08+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 418504348,
+ "user": "user_0fa58b6f3572",
+ "body": "GitHub is rendering this oddly. Is this a tab or some kind of mixed white space?",
+ "path": "requests/__init__.py",
+ "line": 106,
+ "side": "RIGHT",
+ "created_at": "2020-05-01T11:16:49+00:00"
+ },
+ {
+ "id": 418530448,
+ "user": "user_b08fb5f52ea1",
+ "body": "That is a strange render but as far as I can tell they're all spaces.",
+ "path": "requests/__init__.py",
+ "line": 106,
+ "side": "RIGHT",
+ "created_at": "2020-05-01T12:59:03+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "DISMISSED": 2,
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "960fc2339f0488a2",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.479306+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5437,
+ "title": "docs: make danger of verify=False clearer",
+ "body": "This PR makes the danger of setting `verify=False` clearer to users of requests. In many cases, users may set this to `False` when running into problems locally with self-signed certificates, but not realize the risk they are opening themselves up to.\n\nAs an example of how the dangers of not verifying TLS (SSL) certificates is communicated, see Go's `InsecureSkipVerify` docs: https://golang.org/pkg/crypto/tls/\n\n```\n // InsecureSkipVerify controls whether a client verifies the\n // server's certificate chain and host name.\n // If InsecureSkipVerify is true, TLS accepts any certificate\n // presented by [NAME_REDACTED] host name in that certificate.\n // In this mode, TLS is susceptible to man-in-the-middle attacks.\n // This should be used only for testing.\n```\n\nHappy to take feedback on the wording / doc-style - this is my first PR to requests but I care a lot about 'safe defaults' in OSS!",
+ "author": "user_5a14ee944efb",
+ "created_at": "2020-04-25T19:07:50+00:00",
+ "merged_at": "2020-08-17T02:31:06+00:00",
+ "base_branch": "master",
+ "head_branch": "elithrar/improve-verify-docs",
+ "additions": 19,
+ "deletions": 1,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -243,6 +243,12 @@ Requests can also ignore verifying the SSL certificate if you set ``verify`` to\n >>> requests.get('https://kennethreitz.org', verify=False)\n \n \n+Note that when ``verify`` is set to ``False``, requests will accept any TLS\n+certificate presented by [NAME_REDACTED], and will ignore hostname mismatches\n+and/or expired certificates, which will make your application vulnerable to\n+man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful\n+during local development or testing.\n+\n By default, ``verify`` is set to True. Option ``verify`` only applies to host certs.\n \n [NAME_REDACTED]"
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 13,
+ "deletions": 1,
+ "changes": 14,
+ "patch": "@@ -387,6 +387,13 @@ def __init__(self):\n self.stream = False\n \n #: SSL Verification default.\n+ #: Defaults to `True`, requiring requests to verify the TLS certificate at the\n+ #: remote end.\n+ #: If verify is set to `False`, requests will accept any TLS certificate\n+ #: presented by [NAME_REDACTED], and will ignore hostname mismatches and/or\n+ #: expired certificates, which will make your application vulnerable to\n+ #: man-in-the-middle (MitM) attacks.\n+ #: Only set this to `False` for testing.\n self.verify = True\n \n #: SSL client certificate default, if String, path to ssl client\n@@ -495,7 +502,12 @@ def request(self, method, url,\n content. Defaults to ``False``.\n :param verify: (optional) Either a boolean, in which case it controls whether we verify\n the server's TLS certificate, or a string, in which case it must be a path\n- to a CA bundle to use. Defaults to ``True``.\n+ to a CA bundle to use. Defaults to ``True``. When set to\n+ ``False``, requests will accept any TLS certificate presented by\n+ the server, and will ignore hostname mismatches and/or expired\n+ certificates, which will make your application vulnerable to\n+ man-in-the-middle (MitM) attacks. Setting verify to ``False`` \n+ may be useful during local development or testing.\n :param cert: (optional) if String, path to ssl client cert file (.pem).\n If Tuple, ('cert', 'key') pair.\n :rtype: requests.Response"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 400498245,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T12:23:28+00:00"
+ },
+ {
+ "id": 400524274,
+ "user": "user_5a14ee944efb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T16:44:34+00:00"
+ },
+ {
+ "id": 400539825,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T19:22:15+00:00"
+ },
+ {
+ "id": 400540986,
+ "user": "user_5a14ee944efb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T19:35:29+00:00"
+ },
+ {
+ "id": 400542509,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T19:52:09+00:00"
+ },
+ {
+ "id": 400555921,
+ "user": "user_5a14ee944efb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-04-26T22:24:27+00:00"
+ },
+ {
+ "id": 425759845,
+ "user": "user_95967246daba",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-06-06T18:33:55+00:00"
+ },
+ {
+ "id": 468129687,
+ "user": "user_b08fb5f52ea1",
+ "state": "APPROVED",
+ "body": "LGTM, thank you for this change.",
+ "submitted_at": "2020-08-17T02:17:30+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 415298042,
+ "user": "user_0fa58b6f3572",
+ "body": "There are (rarely) good cases for setting this to False. I'd remove this line as it's likely to cause a fire-storm for the already overtaxed maintainers of this project",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T12:23:27+00:00"
+ },
+ {
+ "id": 415350484,
+ "user": "user_5a14ee944efb",
+ "body": "I would agree! The reason that I mentioned this was to get ahead of questions about \"why is this configurable in the first place?\" - which is a reasonable question for someone to ask about an option like this. I'm not sure I grok the 'firestorm' part, though.\n\nHappy to elide if there's strong feelings about it, but \"when would I set this to False\" is a fair question for a newcomer to ask.",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T16:44:34+00:00"
+ },
+ {
+ "id": 415381330,
+ "user": "user_0fa58b6f3572",
+ "body": "There are people who jump on things like this as soon as they find it and then they post about it in places to get attention and trigger a pile-on. The project has had issues like this in the past (for example, when it kept it's own certificate bundle copy from Mozilla instead of keeping that in certifi) and so given how sensitive people can be around this particular flag and topic, I'd rather leave this as an uncontroversial item. I think the \"Only\" in this will be controversial enough that people will get spitting mad and try to rile others up as well",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T19:22:15+00:00"
+ },
+ {
+ "id": 415383631,
+ "user": "user_5a14ee944efb",
+ "body": "That’s unfortunate, and hopefully we can point folks to prior art in other libraries/PLs. I have seen pile-ons the other way - e.g where the defaults are _unsafe_. But I digress.\n\nTo make sure I understand your ask concretely: you want me to remove the “Only set this...” sentence from the comment (only) - ?",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T19:35:29+00:00"
+ },
+ {
+ "id": 415386893,
+ "user": "user_0fa58b6f3572",
+ "body": "Or phrase it as `\"You might consider settings to False during local development or testing.\"` as I think that's the idea you're conveying",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T19:52:09+00:00"
+ },
+ {
+ "id": 415414945,
+ "user": "user_5a14ee944efb",
+ "body": "Done.",
+ "path": "requests/sessions.py",
+ "line": 396,
+ "side": "RIGHT",
+ "created_at": "2020-04-26T22:24:27+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 6,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 6
+ }
+}
+{
+ "_id": "d495e23b93f43316",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.481317+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5391,
+ "title": "Send only one Host header in chunked request",
+ "body": "Send only one Host header when specifying a custom Host header in a chunked request.\n\nBefore this fix, the default Host header was sent along with the custom Host header.\n\nCloses #5274",
+ "author": "user_dfe95ac7a79b",
+ "created_at": "2020-03-17T22:01:53+00:00",
+ "merged_at": "2021-11-29T15:58:32+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-5274",
+ "additions": 52,
+ "deletions": 1,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -191,3 +191,4 @@ Patches and Suggestions\n - \"[NAME_REDACTED]\" <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - Sylvain Marié ([CONTRIBUTOR_REDACTED])\n+- [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])"
+ },
+ {
+ "filename": "requests/adapters.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -458,9 +458,11 @@ def send(self, request, stream=False, timeout=None, verify=True, cert=None, prox\n low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)\n \n try:\n+ skip_host = 'Host' in request.headers\n low_conn.putrequest(request.method,\n url,\n- skip_accept_encoding=True)\n+ skip_accept_encoding=True,\n+ skip_host=skip_host)\n \n for header, value in request.headers.items():\n low_conn.putheader(header, value)"
+ },
+ {
+ "filename": "tests/test_lowlevel.py",
+ "status": "modified",
+ "additions": 48,
+ "deletions": 0,
+ "changes": 48,
+ "patch": "@@ -9,6 +9,18 @@\n from .utils import override_environ\n \n \n+def echo_response_handler(sock):\n+ \"\"\"Simple handler that will take request and echo it back to requester.\"\"\"\n+ request_content = consume_socket_content(sock, timeout=0.5)\n+\n+ text_200 = (\n+ b'HTTP/1.1 200 OK\\r\\n'\n+ b'Content-Length: %d\\r\\n\\r\\n'\n+ b'%s'\n+ ) % (len(request_content), request_content)\n+ sock.send(text_200)\n+\n+\n def test_chunked_upload():\n \"\"\"can safely send generators\"\"\"\n close_server = threading.Event()\n@@ -46,6 +58,42 @@ def incomplete_chunked_response_handler(sock):\n close_server.set() # release server block\n \n \n+def test_chunked_upload_uses_only_specified_host_header():\n+ \"\"\"Ensure we use only the specified Host header for chunked requests.\"\"\"\n+ close_server = threading.Event()\n+ server = Server(echo_response_handler, wait_to_close_event=close_server)\n+\n+ data = iter([b'a', b'b', b'c'])\n+ custom_host = 'sample-host'\n+\n+ with server as (host, port):\n+ url = 'http://{}:{}/'.format(host, port)\n+ r = requests.post(url, data=data, headers={'Host': custom_host}, stream=True)\n+ close_server.set() # release server block\n+\n+ expected_header = b'Host: %s\\r\\n' % custom_host.encode('utf-8')\n+ assert expected_header in r.content\n+ assert r.content.count(b'Host: ') == 1\n+\n+\n+def test_chunked_upload_doesnt_skip_host_header():\n+ \"\"\"Ensure we don't omit all Host headers with chunked requests.\"\"\"\n+ close_server = threading.Event()\n+ server = Server(echo_response_handler, wait_to_close_event=close_server)\n+\n+ data = iter([b'a', b'b', b'c'])\n+\n+ with server as (host, port):\n+ expected_host = '{}:{}'.format(host, port)\n+ url = 'http://{}:{}/'.format(host, port)\n+ r = requests.post(url, data=data, stream=True)\n+ close_server.set() # release server block\n+\n+ expected_header = b'Host: %s\\r\\n' % expected_host.encode('utf-8')\n+ assert expected_header in r.content\n+ assert r.content.count(b'Host: ') == 1\n+\n+\n def test_conflicting_content_lengths():\n \"\"\"Ensure we correctly throw an InvalidHeader error if multiple\n conflicting Content-Length headers are returned."
+ }
+ ],
+ "reviews": [
+ {
+ "id": 425760898,
+ "user": "user_95967246daba",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2020-06-06T18:53:59+00:00"
+ },
+ {
+ "id": 530605943,
+ "user": "user_95967246daba",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-11-14T21:30:07+00:00"
+ },
+ {
+ "id": 530606142,
+ "user": "user_95967246daba",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-11-14T21:33:16+00:00"
+ },
+ {
+ "id": 744799683,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Thanks for digging in a finding a simple solution here, [USER_REDACTED]! This seems like a straight forward win that alleviates the risks of other patches we've had for #5274. Apologies this has been sitting so long.\n\nI've added some minor test refactoring to make these easier to expand later and rebased your changes onto our `main` branch. I think this should be set!",
+ "submitted_at": "2021-09-02T08:57:14+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 523465475,
+ "user": "user_95967246daba",
+ "body": "That's good, this appears to be the same way that the same situation is handled in the urllib3 code itself: https://github.com/urllib3/urllib3/blob/74d6be1ab66cef44c0f479c24b0fc1756a8fe4e9/src/urllib3/connection.py#L243-L246",
+ "path": "requests/adapters.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-11-14T21:30:07+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "DISMISSED": 1,
+ "COMMENTED": 1,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "4b9c14f4c1584e54",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.483319+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5336,
+ "title": "Remove explicit unicode literal in README.md and doc",
+ "body": "As the end of python 2 has come, I open this PR in order to get rid of the explicit unicode literal in the README file and the documentation.\nI know that this could be against the PEP 414 https://www.python.org/dev/peps/pep-0414/ but it should be harmless for the project.",
+ "author": "user_f9f268d1dfdc",
+ "created_at": "2020-02-13T21:44:12+00:00",
+ "merged_at": "2020-03-25T19:44:52+00:00",
+ "base_branch": "master",
+ "head_branch": "master",
+ "additions": 17,
+ "deletions": 17,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "README.md",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -38,9 +38,9 @@ by [NAME_REDACTED] & is protected by The <\n >>> r.encoding\n 'utf-8'\n >>> r.text\n-u'{\"type\":\"User\"...'\n+'{\"type\":\"User\"...'\n >>> r.json()\n-{u'disk_usage': 368627, u'private_gists': 484, ...}\n+{'disk_usage': 368627, 'private_gists': 484, ...}\n ```"
+ },
+ {
+ "filename": "docs/index.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -35,9 +35,9 @@ Release v\\ |version|. (:ref:`Installation `)\n >>> r.encoding\n 'utf-8'\n >>> r.text\n- u'{\"type\":\"User\"...'\n+ '{\"type\":\"User\"...'\n >>> r.json()\n- {u'private_gists': 419, u'total_private_repos': 77, ...}\n+ {'private_gists': 419, 'total_private_repos': 77, ...}\n \n See `similar code, sans Requests `_."
+ },
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 11,
+ "changes": 22,
+ "patch": "@@ -698,12 +698,12 @@ So, GitHub returns JSON. That's great, we can use the :meth:`r.json\n >>> commit_data = r.json()\n \n >>> print(commit_data.keys())\n- [u'committer', u'author', u'url', u'tree', u'sha', u'parents', u'message']\n+ ['committer', 'author', 'url', 'tree', 'sha', 'parents', 'message']\n \n- >>> print(commit_data[u'committer'])\n- {u'date': u'2012-05-10T11:10:50-07:00', u'email': u'[EMAIL_REDACTED]', u'name': u'[NAME_REDACTED]'}\n+ >>> print(commit_data['committer'])\n+ {'date': '2012-05-10T11:10:50-07:00', 'email': '[EMAIL_REDACTED]', 'name': '[NAME_REDACTED]'}\n \n- >>> print(commit_data[u'message'])\n+ >>> print(commit_data['message'])\n makin' history\n \n So far, so simple. Well, let's investigate the GitHub API a little bit. Now,\n@@ -746,34 +746,34 @@ this issue already exists, we will use it as an example. Let's start by getting\n \n >>> issue = json.loads(r.text)\n \n- >>> print(issue[u'title'])\n+ >>> print(issue['title'])\n Feature any http verb in docs\n \n- >>> print(issue[u'comments'])\n+ >>> print(issue['comments'])\n 3\n \n Cool, we have three comments. Let's take a look at the last of them.\n \n ::\n \n- >>> r = requests.get(r.url + u'/comments')\n+ >>> r = requests.get(r.url + '/comments')\n >>> r.status_code\n 200\n \n >>> comments = r.json()\n \n >>> print(comments[0].keys())\n- [u'body', u'url', u'created_at', u'updated_at', u'user', u'id']\n+ ['body', 'url', 'created_at', 'updated_at', 'user', 'id']\n \n- >>> print(comments[2][u'body'])\n+ >>> print(comments[2]['body'])\n Probably in the \"advanced\" section\n \n Well, that seems like a silly place. Let's post a comment telling the poster\n that he's silly. Who is the poster, anyway?\n \n ::\n \n- >>> print(comments[2][u'user'][u'login'])\n+ >>> print(comments[2]['user']['login'])\n kennethreitz\n \n OK, so let's tell this Kenneth guy that we think this example should go in the\n@@ -803,7 +803,7 @@ the very common [NAME_REDACTED].\n 201\n \n >>> content = r.json()\n- >>> print(content[u'body'])\n+ >>> print(content['body'])\n Sounds great! I'll get right on it.\n \n Brilliant. Oh, wait, no! I meant to add that it would take me a while, because"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -93,7 +93,7 @@ again::\n \n >>> r = requests.get('https://api.github.com/events')\n >>> r.text\n- u'[{\"repository\":{\"open_issues\":0,\"url\":\"https://github.com/...\n+ '[{\"repository\":{\"open_issues\":0,\"url\":\"https://github.com/...\n \n Requests will automatically decode content from the server. Most unicode\n charsets are seamlessly decoded.\n@@ -148,7 +148,7 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data::\n \n >>> r = requests.get('https://api.github.com/events')\n >>> r.json()\n- [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...\n+ [{'repository': {'open_issues': 0, 'url': 'https://github.com/...\n \n In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if\n the response gets a 204 ([NAME_REDACTED]), or if the response contains invalid JSON,"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 359421730,
+ "user": "user_278727a2e287",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2020-02-16T18:49:54+00:00"
+ },
+ {
+ "id": 360118718,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": "This looks good to me, would you mind squashing and rebasing onto master?",
+ "submitted_at": "2020-02-18T07:35:29+00:00"
+ },
+ {
+ "id": 363112908,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-02-23T18:16:25+00:00"
+ },
+ {
+ "id": 363225969,
+ "user": "user_f9f268d1dfdc",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-02-24T08:39:09+00:00"
+ },
+ {
+ "id": 369016947,
+ "user": "user_f9f268d1dfdc",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2020-03-04T18:26:59+00:00"
+ },
+ {
+ "id": 371095490,
+ "user": "user_0279b4b0e7d3",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2020-03-09T11:41:48+00:00"
+ },
+ {
+ "id": 381479817,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Thanks [USER_REDACTED]!",
+ "submitted_at": "2020-03-25T19:44:03+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 383026460,
+ "user": "user_0fa58b6f3572",
+ "body": "Missed one here",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-02-23T18:16:24+00:00"
+ },
+ {
+ "id": 383132683,
+ "user": "user_f9f268d1dfdc",
+ "body": "Thanks! I'll fix it as soon as possible.",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-02-24T08:39:09+00:00"
+ },
+ {
+ "id": 387851529,
+ "user": "user_f9f268d1dfdc",
+ "body": "Fixed!",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2020-03-04T18:26:58+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "md",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "DISMISSED": 2,
+ "COMMENTED": 3,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "3e97453ae8c53f51",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.485315+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 5208,
+ "title": "Part II: The Principle of Polarity",
+ "body": "Love & Hated appear orthogonal, yet are extracted from the same substance & essences. The opposite of Love is not Hatred — but Apathy.\n\n> Everything is dual; Everything has poles; Everything has its pair of opposites; Like and unlike are the same; Opposites are identical in nature, but different in degree; Extremes meet; All truths, are but half-truths; All paradoxes may be reconciled.\n\n[As above, so below](https://www.kennethreitz.org/as-above-so-below).\n\n☤",
+ "author": "user_36df932e8b7a",
+ "created_at": "2019-09-23T18:27:34+00:00",
+ "merged_at": "2019-09-23T20:08:41+00:00",
+ "base_branch": "master",
+ "head_branch": "partII",
+ "additions": 15,
+ "deletions": 20,
+ "changed_files": 6,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 4,
+ "changes": 6,
+ "patch": "@@ -1,16 +1,14 @@\n-Requests is written and maintained by [NAME_REDACTED]\n-various contributors:\n+Requests was lovingly created by [NAME_REDACTED] the Crystals\n ```````````````````````\n \n-- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED], Keeper of the Master Crystal.\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]\n \n Previous Keepers of Crystals\n ````````````````````````````\n-\n+- [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED], reluctant Keeper of the Master Crystal.\n - [NAME_REDACTED] <[EMAIL_REDACTED]> [CONTRIBUTOR_REDACTED]"
+ },
+ {
+ "filename": "README.md",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 16,
+ "changes": 28,
+ "patch": "@@ -1,9 +1,10 @@\n \n \n \n- \n+\n \n- \n+ \n+ \n \n
\n
Python 3.7.4 (default, Sep 7 2019, 18:27:02)\n@@ -12,15 +13,11 @@\n
>>> r.json()[\"description\"]\n
'A simple, yet elegant HTTP library. Handcrafted, with ♥, for the Python community.'\n
\n- \n- \n- \n+\n \n-This software has been designed for you, with much joy, \n-by [NAME_REDACTED] & is secured by The [NAME_REDACTED] . \n+This software has been designed for you, with much joy,\n+by [NAME_REDACTED] & is protected by The [NAME_REDACTED] .\n
\n-
\n- \n \n \n \n@@ -71,14 +68,14 @@ Requests is ready for the demands of building robust and reliable HTTP–speak a\n \n \n + [NAME_REDACTED] and URLs + Keep-Alive & [NAME_REDACTED]\n- + Sessions with [NAME_REDACTED] + Browser-style SSL Verification \n- + Basic & [NAME_REDACTED] + Familiar `dict`–like Cookies \n- + [NAME_REDACTED] of Content + [NAME_REDACTED] \n+ + Sessions with [NAME_REDACTED] + Browser-style SSL Verification\n+ + Basic & [NAME_REDACTED] + Familiar `dict`–like Cookies\n+ + [NAME_REDACTED] of Content + [NAME_REDACTED]\n + [NAME_REDACTED] + [NAME_REDACTED]* \n- + [NAME_REDACTED] + SOCKS [NAME_REDACTED] \n+ + [NAME_REDACTED] + SOCKS [NAME_REDACTED]\n + [NAME_REDACTED] + [NAME_REDACTED]\n- + Automatic honoring of `.netrc` + Chunked HTTP Requests \n- \n+ + Automatic honoring of `.netrc` + Chunked HTTP Requests\n+\n &, of course, rock–solid stability!\n \n \n@@ -127,4 +124,3 @@ Requests officially supports Python 2.7 & 3.4–3.8.\n \n \n
\n-"
+ },
+ {
+ "filename": "ext/LICENSE",
+ "status": "added",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -0,0 +1 @@\n+Copyright 2019 [NAME_REDACTED] reserved."
+ },
+ {
+ "filename": "ext/deepmind-kr.jpg",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 0,
+ "changes": 0,
+ "patch": null
+ },
+ {
+ "filename": "ext/flourish.jpg",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 0,
+ "changes": 0,
+ "patch": null
+ },
+ {
+ "filename": "ext/flower-of-life.jpg",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 0,
+ "changes": 0,
+ "patch": null
+ }
+ ],
+ "reviews": [
+ {
+ "id": 291974410,
+ "user": "user_c71bba18f1eb",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2019-09-23T18:35:47+00:00"
+ },
+ {
+ "id": 291976846,
+ "user": "user_36df932e8b7a",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2019-09-23T18:39:59+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 327269074,
+ "user": "user_36df932e8b7a",
+ "body": "**Note**: this is for the images contained within the `ext` folder, which includes a [tattoo upon my arm](https://images.squarespace-cdn.com/content/v1/533ad9bde4b098d084a846b1/1469928300857-S9WKXBO0CCRX0RL4PJYX/ke17ZwdGBToddI8pDm48kKLHmMs23ZxPgeOu8Yrs55d7gQa3H78H3Y0txjaiv_0fDoOvxcdMmMKkDsyUqMSsMWxHk725yiiHCCLfrh8O1z4YTzHvnKhyp6Da-NYroOW3ZGjoBKy3azqku80C789l0iyqMbMesKd95J-X4EagrgXXATmnXitsEasKvdtVty7KcIpiUOmkkpuOP9PWkdpi9w/L1000129-Edit.jpg?format=1500w) — I had the tattoo before I made it the Requests logo :)",
+ "path": "ext/LICENSE",
+ "line": 1,
+ "side": "RIGHT",
+ "created_at": "2019-09-23T18:39:59+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "jpg",
+ "md",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "a3716fe2faa7fd3c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.487316+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4987,
+ "title": "[fix] fix failing doctests in requests/*",
+ "body": "## Why this PR\nRunning the command:\n`\n$ py.test --doctest-module requests\n`\ngives failing doctests. This PR aims to fix these failing doctests.\n\n[NAME_REDACTED]: https://github.com/[USER_REDACTED]nethreitz/requests/issues/4986\n\n## How to test\n`\n$ py.test --doctest-module requests\n`\nAll the 11 doctests should pass.",
+ "author": "user_f9f268d1dfdc",
+ "created_at": "2019-02-17T18:47:44+00:00",
+ "merged_at": "2019-08-20T04:25:51+00:00",
+ "base_branch": "master",
+ "head_branch": "master",
+ "additions": 18,
+ "deletions": 9,
+ "changed_files": 8,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 0,
+ "changes": 2,
+ "patch": "@@ -189,5 +189,7 @@ Patches and Suggestions\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n+- \"[NAME_REDACTED]\" <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n+- [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])"
+ },
+ {
+ "filename": "pytest.ini",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -1,2 +1,3 @@\n [pytest]\n-addopts = -p no:warnings\n\\ No newline at end of file\n+addopts = -p no:warnings --doctest-modules\n+doctest_optionflags= NORMALIZE_WHITESPACE ELLIPSIS\n\\ No newline at end of file"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 5,
+ "changes": 10,
+ "patch": "@@ -9,14 +9,14 @@\n Requests HTTP Library\n ~~~~~~~~~~~~~~~~~~~~~\n \n-Requests is an HTTP library, written in Python, for human beings. Basic GET\n-usage:\n+Requests is an HTTP library, written in Python, for human beings.\n+Basic GET usage:\n \n >>> import requests\n >>> r = requests.get('https://www.python.org')\n >>> r.status_code\n 200\n- >>> 'Python is a programming language' in r.content\n+ >>> b'Python is a programming language' in r.content\n True\n \n ... or POST:\n@@ -27,8 +27,8 @@\n {\n ...\n \"form\": {\n- \"key2\": \"value2\",\n- \"key1\": \"value1\"\n+ \"key1\": \"value1\",\n+ \"key2\": \"value2\"\n },\n ...\n }"
+ },
+ {
+ "filename": "requests/api.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -50,6 +50,7 @@ def request(method, url, **kwargs):\n \n >>> import requests\n >>> req = requests.request('GET', 'https://httpbin.org/get')\n+ >>> req\n \n \"\"\""
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -280,6 +280,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):\n >>> import requests\n >>> req = requests.Request('GET', 'https://httpbin.org/get')\n >>> r = req.prepare()\n+ >>> r\n \n \n >>> s = requests.Session()"
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -354,7 +354,7 @@ class Session(SessionRedirectMixin):\n Or as a context manager::\n \n >>> with requests.Session() as s:\n- >>> s.get('https://httpbin.org/get')\n+ ... s.get('https://httpbin.org/get')\n \n \"\"\""
+ },
+ {
+ "filename": "requests/status_codes.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -4,7 +4,7 @@\n The ``codes`` object defines a mapping from common names for HTTP statuses\n to their numerical codes, accessible either as attributes or as dictionary\n items.\n-\n+>>> import requests\n >>> requests.codes['temporary_redirect']\n 307\n >>> requests.codes.teapot"
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 1,
+ "changes": 6,
+ "patch": "@@ -267,6 +267,8 @@ def from_key_val_list(value):\n >>> from_key_val_list([('key', 'val')])\n OrderedDict([('key', 'val')])\n >>> from_key_val_list('string')\n+ Traceback (most recent call last):\n+ ...\n ValueError: cannot encode objects that are not 2-tuples\n >>> from_key_val_list({'key': 'val'})\n OrderedDict([('key', 'val')])\n@@ -293,7 +295,9 @@ def to_key_val_list(value):\n >>> to_key_val_list({'key': 'val'})\n [('key', 'val')]\n >>> to_key_val_list('string')\n- ValueError: cannot encode objects that are not 2-tuples.\n+ Traceback (most recent call last):\n+ ...\n+ ValueError: cannot encode objects that are not 2-tuples\n \n :rtype: list\n \"\"\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 204579935,
+ "user": "user_378b41443422",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2019-02-17T21:00:20+00:00"
+ },
+ {
+ "id": 212580668,
+ "user": "user_378b41443422",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2019-03-09T22:57:01+00:00"
+ },
+ {
+ "id": 237178192,
+ "user": "user_ba9b4e1a5bdb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2019-05-14T11:19:54+00:00"
+ },
+ {
+ "id": 237790724,
+ "user": "user_f9f268d1dfdc",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2019-05-15T12:35:57+00:00"
+ },
+ {
+ "id": 239240546,
+ "user": "user_f9f268d1dfdc",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2019-05-19T14:27:42+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 283747119,
+ "user": "user_ba9b4e1a5bdb",
+ "body": "Hi, I would suggest to do so: \n```\n >>> print(r.text)\n ... # doctest: +ELLIPSIS\n ... # doctest: +NORMALIZE_WHITESPACE\n {\n ...\n \"form\": {\n \"key2\": \"value2\",\n \"key1\": \"value1\"\n },\n ...\n }\n```\nSo we change the test minimally.",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2019-05-14T11:18:48+00:00"
+ },
+ {
+ "id": 284231760,
+ "user": "user_f9f268d1dfdc",
+ "body": "Thanks. I did not know that I could use this syntax. I'm going to change it according to your suggestion.",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2019-05-15T12:35:56+00:00"
+ },
+ {
+ "id": 285383435,
+ "user": "user_f9f268d1dfdc",
+ "body": "I added NORMALIZE_WHITESPACE and ELLIPSIS to the pytest.ini file and removed from the doctest in order to use them in pytest configuration.",
+ "path": "requests/__init__.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2019-05-19T14:27:41+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "ini",
+ "py",
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "DISMISSED": 1,
+ "COMMENTED": 3
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "eb058106b657e3d4",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.488548+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4915,
+ "title": "Normalize percent-encoded bytes before comparison",
+ "body": "urllib3 replaced it's URL parser with `rfc3986` for more compliant parsing (urllib3/urllib3#1487). We've also got an effort underway to run downstream tests before releases (urllib3/urllib3#1508) and during that process we've discovered that requests requires percent-encoded bytes to keep their casing.\n\nAdding this to the unit tests would allow either version of pre- and post-rfc3986 urllib3 to pass requests unit tests. I don't know if the `Request.url` attribute needs to maintain it's casing in this situation or not, if it does this is not the solution. Just putting this together as a potential solution.",
+ "author": "user_b08fb5f52ea1",
+ "created_at": "2018-12-23T21:54:59+00:00",
+ "merged_at": "2019-01-21T13:58:33+00:00",
+ "base_branch": "master",
+ "head_branch": "patch-1",
+ "additions": 13,
+ "deletions": 4,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": ".travis.yml",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -38,5 +38,5 @@ jobs:\n dist: xenial\n sudo: true \n - stage: coverage\n- python: 3.6\n+ python: '3.6'\n script: codecov"
+ },
+ {
+ "filename": "Makefile",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,7 +1,7 @@\n .PHONY: docs\n init:\n \tpip install pipenv --upgrade\n-\tpipenv install --dev --skip-lock\n+\tpipenv install --dev\n test:\n \t# This runs all of the tests, on both Python 2 and Python 3.\n \tdetox"
+ },
+ {
+ "filename": "Pipfile",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -4,7 +4,7 @@ verify_ssl = true\n name = \"pypi\"\n \n [dev-packages]\n-pytest = \">=2.8.0\"\n+pytest = \">=2.8.0,<4.1\"\n codecov = \"*\"\n pytest-httpbin = \">=0.0.7\"\n pytest-mock = \"*\""
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 1,
+ "changes": 11,
+ "patch": "@@ -9,6 +9,7 @@\n import collections\n import contextlib\n import warnings\n+import re\n \n import io\n import requests\n@@ -2418,9 +2419,17 @@ class TestPreparingURLs(object):\n )\n )\n def test_preparing_url(self, url, expected):\n+\n+ def normalize_percent_encode(x):\n+ # Helper function that normalizes equivalent \n+ # percent-encoded bytes before comparisons\n+ for c in re.findall(r'%[a-fA-F0-9]{2}', x):\n+ x = x.replace(c, c.upper())\n+ return x\n+ \n r = requests.Request('GET', url=url)\n p = r.prepare()\n- assert p.url == expected\n+ assert normalize_percent_encode(p.url) == expected\n \n [USER_REDACTED].mark.parametrize(\n 'url',"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 187704190,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": "pchars don't have case-sensitivity as the RFC describes them so I see no issue with this fix for our tests.",
+ "submitted_at": "2018-12-24T14:36:20+00:00"
+ },
+ {
+ "id": 194610821,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2019-01-21T13:58:16+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 249458508,
+ "user": "user_0fa58b6f3572",
+ "body": "This is odd",
+ "path": ".travis.yml",
+ "line": 41,
+ "side": "RIGHT",
+ "created_at": "2019-01-21T13:56:36+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "yml"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "DISMISSED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "70fc79acb3da8199",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.490896+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4835,
+ "title": "v2.20.0",
+ "body": "2.20.0 (2018-10-??)\n-------------------\n**Bugfixes**\n\n- Content-Type header parsing is now case-insensitive (e.g.\n charset=utf8 v Charset=utf8).\n- Fixed exception leak where certain redirect urls would raise\n uncaught urllib3 exceptions.\n- Requests removes Authorization headers from requests redirected\n from https to http on the same hostname. (CVE-2018-18074)\n- `should_bypass_proxies` now handles URIs without hostnames, e.g. files.\n\n**Dependencies**\n- We now support urllib3 v1.24.\n\n**Deprecations**\n- Requests has officially stopped support for Python 2.6.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2018-10-17T15:55:17+00:00",
+ "merged_at": "2018-10-18T15:44:50+00:00",
+ "base_branch": "master",
+ "head_branch": "2.20.0",
+ "additions": 88,
+ "deletions": 102,
+ "changed_files": 20,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -125,7 +125,7 @@ Patches and Suggestions\n - [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n-- [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n+- [NAME_REDACTED] <[EMAIL_REDACTED]> ([CONTRIBUTOR_REDACTED])\n - Łukasz Langa <[EMAIL_REDACTED]>\n - [NAME_REDACTED] <[EMAIL_REDACTED]>\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])"
+ },
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 1,
+ "changes": 19,
+ "patch": "@@ -6,12 +6,29 @@ dev\n \n **Bugfixes**\n \n+- \\[Short description of non-trivial change.\\]\n+\n+2.20.0 (2018-10-18)\n+-------------------\n+\n+**Bugfixes**\n+\n - Content-Type header parsing is now case-insensitive (e.g.\n charset=utf8 v Charset=utf8).\n - Fixed exception leak where certain redirect urls would raise\n uncaught urllib3 exceptions.\n+- Requests removes Authorization header from requests redirected\n+ from https to http on the same hostname. (CVE-2018-18074)\n+- `should_bypass_proxies` now handles URIs without hostnames (e.g.\n+ files).\n \n-- \\[Short description of non-trivial change.\\]\n+**Dependencies**\n+\n+- Requests now supports urllib3 v1.24.\n+\n+**Deprecations**\n+\n+- Requests has officially stopped support for Python 2.6.\n \n 2.19.1 (2018-06-14)\n -------------------"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 10,
+ "changes": 15,
+ "patch": "@@ -57,10 +57,10 @@ def check_compatibility(urllib3_version, chardet_version):\n # Check urllib3 for compatibility.\n major, minor, patch = urllib3_version # noqa: F811\n major, minor, patch = int(major), int(minor), int(patch)\n- # urllib3 >= 1.21.1, <= 1.23\n+ # urllib3 >= 1.21.1, <= 1.24\n assert major == 1\n assert minor >= 21\n- assert minor <= 23\n+ assert minor <= 24\n \n # Check chardet for compatibility.\n major, minor, patch = chardet_version.split('.')[:3]\n@@ -79,14 +79,14 @@ def _check_cryptography(cryptography_version):\n return\n \n if cryptography_version < [1, 3, 4]:\n- warning = 'Old version of cryptography ({0}) may cause slowdown.'.format(cryptography_version)\n+ warning = 'Old version of cryptography ({}) may cause slowdown.'.format(cryptography_version)\n warnings.warn(warning, RequestsDependencyWarning)\n \n # Check imported dependencies for compatibility.\n try:\n check_compatibility(urllib3.__version__, chardet.__version__)\n except (AssertionError, ValueError):\n- warnings.warn(\"urllib3 ({0}) or chardet ({1}) doesn't match a supported \"\n+ warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n \"version!\".format(urllib3.__version__, chardet.__version__),\n RequestsDependencyWarning)\n \n@@ -123,12 +123,7 @@ def _check_cryptography(cryptography_version):\n \n # Set default logging handler to avoid \"No handler found\" warnings.\n import logging\n-try: # Python 2.7+\n- from logging import NullHandler\n-except ImportError:\n- class NullHandler(logging.Handler):\n- def emit(self, record):\n- pass\n+from logging import NullHandler\n \n logging.getLogger(__name__).addHandler(NullHandler())"
+ },
+ {
+ "filename": "requests/__version__.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -5,8 +5,8 @@\n __title__ = 'requests'\n __description__ = 'Python HTTP for Humans.'\n __url__ = 'http://python-requests.org'\n-__version__ = '2.19.1'\n-__build__ = 0x021901\n+__version__ = '2.20.0'\n+__build__ = 0x022000\n __author__ = '[NAME_REDACTED]'\n __author_email__ = '[EMAIL_REDACTED]'\n __license__ = 'Apache 2.0'"
+ },
+ {
+ "filename": "requests/adapters.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 9,
+ "changes": 16,
+ "patch": "@@ -129,8 +129,7 @@ def __init__(self, pool_connections=DEFAULT_POOLSIZE,\n self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)\n \n def __getstate__(self):\n- return dict((attr, getattr(self, attr, None)) for attr in\n- self.__attrs__)\n+ return {attr: getattr(self, attr, None) for attr in self.__attrs__}\n \n def __setstate__(self, state):\n # Can't handle by adding 'proxy_manager' to self.__attrs__ because\n@@ -226,7 +225,7 @@ def cert_verify(self, conn, url, verify, cert):\n \n if not cert_loc or not os.path.exists(cert_loc):\n raise IOError(\"Could not find a suitable TLS CA certificate bundle, \"\n- \"invalid path: {0}\".format(cert_loc))\n+ \"invalid path: {}\".format(cert_loc))\n \n conn.cert_reqs = 'CERT_REQUIRED'\n \n@@ -248,10 +247,10 @@ def cert_verify(self, conn, url, verify, cert):\n conn.key_file = None\n if conn.cert_file and not os.path.exists(conn.cert_file):\n raise IOError(\"Could not find the TLS certificate file, \"\n- \"invalid path: {0}\".format(conn.cert_file))\n+ \"invalid path: {}\".format(conn.cert_file))\n if conn.key_file and not os.path.exists(conn.key_file):\n raise IOError(\"Could not find the TLS key file, \"\n- \"invalid path: {0}\".format(conn.key_file))\n+ \"invalid path: {}\".format(conn.key_file))\n \n def build_response(self, req, resp):\n \"\"\"Builds a :class:`Response ` object from a urllib3\n@@ -426,7 +425,7 @@ def send(self, request, stream=False, timeout=None, verify=True, cert=None, prox\n timeout = TimeoutSauce(connect=connect, read=read)\n except ValueError as e:\n # this may raise a string formatting error.\n- err = (\"Invalid timeout {0}. Pass a (connect, read) \"\n+ err = (\"Invalid timeout {}. Pass a (connect, read) \"\n \"timeout tuple, or a single float to set \"\n \"both timeouts to the same value\".format(timeout))\n raise ValueError(err)\n@@ -476,11 +475,10 @@ def send(self, request, stream=False, timeout=None, verify=True, cert=None, prox\n \n # Receive the response from the server\n try:\n- # For Python 2.7+ versions, use buffering of HTTP\n- # responses\n+ # For Python 2.7, use buffering of HTTP responses\n r = low_conn.getresponse(buffering=True)\n except TypeError:\n- # For compatibility with Python 2.6 versions and back\n+ # For compatibility with Python 3.3+\n r = low_conn.getresponse()\n \n resp = HTTPResponse.from_httplib("
+ },
+ {
+ "filename": "requests/auth.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -38,7 +38,7 @@ def _basic_auth_str(username, password):\n if not isinstance(username, basestring):\n warnings.warn(\n \"Non-string usernames will no longer be supported in Requests \"\n- \"3.0.0. Please convert the object you've passed in ({0!r}) to \"\n+ \"3.0.0. Please convert the object you've passed in ({!r}) to \"\n \"a string or bytes object in the near future to avoid \"\n \"problems.\".format(username),\n category=DeprecationWarning,\n@@ -48,7 +48,7 @@ def _basic_auth_str(username, password):\n if not isinstance(password, basestring):\n warnings.warn(\n \"Non-string passwords will no longer be supported in Requests \"\n- \"3.0.0. Please convert the object you've passed in ({0!r}) to \"\n+ \"3.0.0. Please convert the object you've passed in ({!r}) to \"\n \"a string or bytes object in the near future to avoid \"\n \"problems.\".format(password),\n category=DeprecationWarning,"
+ },
+ {
+ "filename": "requests/compat.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 2,
+ "changes": 3,
+ "patch": "@@ -43,9 +43,8 @@\n import cookielib\n from Cookie import Morsel\n from StringIO import StringIO\n- from collections import Callable, Mapping, MutableMapping\n+ from collections import Callable, Mapping, MutableMapping, OrderedDict\n \n- from urllib3.packages.ordered_dict import OrderedDict\n \n builtin_str = str\n bytes = str"
+ },
+ {
+ "filename": "requests/cookies.py",
+ "status": "modified",
+ "additions": 15,
+ "deletions": 14,
+ "changes": 29,
+ "patch": "@@ -444,20 +444,21 @@ def create_cookie(name, value, **kwargs):\n By default, the pair of `name` and `value` will be set for the domain ''\n and sent on every request (this is sometimes called a \"supercookie\").\n \"\"\"\n- result = dict(\n- version=0,\n- name=name,\n- value=value,\n- port=None,\n- domain='',\n- path='/',\n- secure=False,\n- expires=None,\n- discard=True,\n- comment=None,\n- comment_url=None,\n- rest={'HttpOnly': None},\n- rfc2109=False,)\n+ result = {\n+ 'version': 0,\n+ 'name': name,\n+ 'value': value,\n+ 'port': None,\n+ 'domain': '',\n+ 'path': '/',\n+ 'secure': False,\n+ 'expires': None,\n+ 'discard': True,\n+ 'comment': None,\n+ 'comment_url': None,\n+ 'rest': {'HttpOnly': None},\n+ 'rfc2109': False,\n+ }\n \n badargs = set(kwargs) - set(result)\n if badargs:"
+ },
+ {
+ "filename": "requests/help.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 2,
+ "changes": 3,
+ "patch": "@@ -89,8 +89,7 @@ def info():\n 'version': getattr(idna, '__version__', ''),\n }\n \n- # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.\n- system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)\n+ system_ssl = ssl.OPENSSL_VERSION_NUMBER\n system_ssl_info = {\n 'version': '%x' % system_ssl if system_ssl is not None else ''\n }"
+ },
+ {
+ "filename": "requests/hooks.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -15,14 +15,14 @@\n \n \n def default_hooks():\n- return dict((event, []) for event in HOOKS)\n+ return {event: [] for event in HOOKS}\n \n # TODO: response is the only one\n \n \n def dispatch_hook(key, hooks, hook_data, **kwargs):\n \"\"\"Dispatches a hook dictionary on a given piece of data.\"\"\"\n- hooks = hooks or dict()\n+ hooks = hooks or {}\n hooks = hooks.get(key)\n if hooks:\n if hasattr(hooks, '__call__'):"
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 4,
+ "changes": 5,
+ "patch": "@@ -652,10 +652,7 @@ def __getstate__(self):\n if not self._content_consumed:\n self.content\n \n- return dict(\n- (attr, getattr(self, attr, None))\n- for attr in self.__attrs__\n- )\n+ return {attr: getattr(self, attr, None) for attr in self.__attrs__}\n \n def __setstate__(self, state):\n for name, value in state.items():"
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -738,7 +738,7 @@ def mount(self, prefix, adapter):\n self.adapters[key] = self.adapters.pop(key)\n \n def __getstate__(self):\n- state = dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)\n+ state = {attr: getattr(self, attr, None) for attr in self.__attrs__}\n return state\n \n def __setstate__(self, state):"
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 8,
+ "changes": 11,
+ "patch": "@@ -173,7 +173,7 @@ def get_netrc_auth(url, raise_errors=False):\n \n for f in NETRC_FILES:\n try:\n- loc = os.path.expanduser('~/{0}'.format(f))\n+ loc = os.path.expanduser('~/{}'.format(f))\n except KeyError:\n # os.path.expanduser can fail when $HOME is undefined and\n # getpwuid fails. See https://bugs.python.org/issue20164 &\n@@ -729,21 +729,16 @@ def should_bypass_proxies(url, no_proxy):\n else:\n host_with_port = parsed.hostname\n if parsed.port:\n- host_with_port += ':{0}'.format(parsed.port)\n+ host_with_port += ':{}'.format(parsed.port)\n \n for host in no_proxy:\n if parsed.hostname.endswith(host) or host_with_port.endswith(host):\n # The URL does match something in no_proxy, so we don't want\n # to apply the proxies on this URL.\n return True\n \n- # If the system proxy settings indicate that this URL should be bypassed,\n- # don't proxy.\n- # The proxy_bypass function is incredibly buggy on OS X in early versions\n- # of Python 2.6, so allow this call to fail. Only catch the specific\n- # exceptions we've seen, though: this call failing in other ways can reveal\n- # legitimate problems.\n with set_environ('no_proxy', no_proxy_arg):\n+ # parsed.hostname can be `None` in cases such as a file URI.\n try:\n bypass = proxy_bypass(parsed.hostname)\n except (TypeError, socket.gaierror):"
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 10,
+ "changes": 14,
+ "patch": "@@ -39,18 +39,12 @@ def run_tests(self):\n os.system('twine upload dist/*')\n sys.exit()\n \n-# pyOpenSSL version 18.0.0 dropped support for Python 2.6\n-if sys.version_info < (2, 7):\n- PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14, < 18.0.0'\n-else:\n- PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14'\n-\n packages = ['requests']\n \n requires = [\n 'chardet>=3.0.2,<3.1.0',\n 'idna>=2.5,<2.8',\n- 'urllib3>=1.21.1,<1.24',\n+ 'urllib3>=1.21.1,<1.25',\n 'certifi>=2017.4.17'\n \n ]\n@@ -85,7 +79,7 @@ def run_tests(self):\n package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},\n package_dir={'requests': 'requests'},\n include_package_data=True,\n- python_requires=\">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*\",\n+ python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*\",\n install_requires=requires,\n license=about['__license__'],\n zip_safe=False,\n@@ -108,8 +102,8 @@ def run_tests(self):\n cmdclass={'test': PyTest},\n tests_require=test_requirements,\n extras_require={\n- 'security': [PYOPENSSL_VERSION, 'cryptography>=1.3.4', 'idna>=2.0.0'],\n+ 'security': ['pyOpenSSL >= 0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],\n 'socks': ['PySocks>=1.5.6, !=1.5.7'],\n- 'socks:sys_platform == \"win32\" and (python_version == \"2.7\" or python_version == \"2.6\")': ['win_inet_pton'],\n+ 'socks:sys_platform == \"win32\" and python_version == \"2.7\"': ['win_inet_pton'],\n },\n )"
+ },
+ {
+ "filename": "tests/test_help.py",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 9,
+ "changes": 9,
+ "patch": "@@ -7,15 +7,6 @@\n from requests.help import info\n \n \n-[USER_REDACTED].mark.skipif(sys.version_info[:2] != (2,6), reason=\"Only run on Python 2.6\")\n-def test_system_ssl_py26():\n- \"\"\"OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't\n- blow up in this case.\n- \"\"\"\n- assert info()['system_ssl'] == {'version': ''}\n-\n-\n-[USER_REDACTED].mark.skipif(sys.version_info < (2,7), reason=\"Only run on Python 2.7+\")\n def test_system_ssl():\n \"\"\"Verify we're actually setting system_ssl when it should be available.\"\"\"\n assert info()['system_ssl']['version'] != ''"
+ },
+ {
+ "filename": "tests/test_lowlevel.py",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 14,
+ "changes": 28,
+ "patch": "@@ -16,7 +16,7 @@ def test_chunked_upload():\n data = iter([b'a', b'b', b'c'])\n \n with server as (host, port):\n- url = 'http://{0}:{1}/'.format(host, port)\n+ url = 'http://{}:{}/'.format(host, port)\n r = requests.post(url, data=data, stream=True)\n close_server.set() # release server block\n \n@@ -77,7 +77,7 @@ def digest_response_handler(sock):\n server = Server(digest_response_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = 'http://{0}:{1}/'.format(host, port)\n+ url = 'http://{}:{}/'.format(host, port)\n r = requests.get(url, auth=auth)\n # Verify server succeeded in authenticating.\n assert r.status_code == 200\n@@ -127,7 +127,7 @@ def digest_failed_response_handler(sock):\n server = Server(digest_failed_response_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = 'http://{0}:{1}/'.format(host, port)\n+ url = 'http://{}:{}/'.format(host, port)\n r = requests.get(url, auth=auth)\n # Verify server didn't authenticate us.\n assert r.status_code == 401\n@@ -164,7 +164,7 @@ def digest_response_handler(sock):\n server = Server(digest_response_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = 'http://{0}:{1}/'.format(host, port)\n+ url = 'http://{}:{}/'.format(host, port)\n r = requests.get(url, auth=auth)\n # Verify server didn't receive auth from us.\n assert r.status_code == 200\n@@ -181,17 +181,17 @@ def digest_response_handler(sock):\n _proxy_combos = []\n for prefix, schemes in _schemes_by_var_prefix:\n for scheme in schemes:\n- _proxy_combos.append((\"{0}_proxy\".format(prefix), scheme))\n+ _proxy_combos.append((\"{}_proxy\".format(prefix), scheme))\n \n _proxy_combos += [(var.upper(), scheme) for var, scheme in _proxy_combos]\n \n \n [USER_REDACTED].mark.parametrize(\"var,scheme\", _proxy_combos)\n def test_use_proxy_from_environment(httpbin, var, scheme):\n- url = \"{0}://httpbin.org\".format(scheme)\n+ url = \"{}://httpbin.org\".format(scheme)\n fake_proxy = Server() # do nothing with the requests; just close the socket\n with fake_proxy as (host, port):\n- proxy_url = \"socks5://{0}:{1}\".format(host, port)\n+ proxy_url = \"socks5://{}:{}\".format(host, port)\n kwargs = {var: proxy_url}\n with override_environ(**kwargs):\n # fake proxy's lack of response will cause a ConnectionError\n@@ -212,7 +212,7 @@ def test_redirect_rfc1808_to_non_ascii_location():\n \n def redirect_resp_handler(sock):\n consume_socket_content(sock, timeout=0.5)\n- location = u'//{0}:{1}/{2}'.format(host, port, path)\n+ location = u'//{}:{}/{}'.format(host, port, path)\n sock.send(\n b'HTTP/1.1 301 Moved Permanently\\r\\n'\n b'Content-Length: 0\\r\\n'\n@@ -226,13 +226,13 @@ def redirect_resp_handler(sock):\n server = Server(redirect_resp_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = u'http://{0}:{1}'.format(host, port)\n+ url = u'http://{}:{}'.format(host, port)\n r = requests.get(url=url, allow_redirects=True)\n assert r.status_code == 200\n assert len(r.history) == 1\n assert r.history[0].status_code == 301\n assert redirect_request[0].startswith(b'GET /' + expected_path + b' HTTP/1.1')\n- assert r.url == u'{0}/{1}'.format(url, expected_path.decode('ascii'))\n+ assert r.url == u'{}/{}'.format(url, expected_path.decode('ascii'))\n \n close_server.set()\n \n@@ -250,7 +250,7 @@ def response_handler(sock):\n server = Server(response_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = 'http://{0}:{1}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n+ url = 'http://{}:{}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n r = requests.get(url)\n raw_request = r.content\n \n@@ -293,7 +293,7 @@ def response_handler(sock):\n server = Server(response_handler, wait_to_close_event=close_server)\n \n with server as (host, port):\n- url = 'http://{0}:{1}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n+ url = 'http://{}:{}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n r = requests.get(url)\n raw_request = r.content\n \n@@ -302,8 +302,8 @@ def response_handler(sock):\n assert r.history[0].request.url == url\n \n # Verify we haven't overwritten the location with our previous fragment.\n- assert r.history[1].request.url == 'http://{0}:{1}/get#relevant-section'.format(host, port)\n+ assert r.history[1].request.url == 'http://{}:{}/get#relevant-section'.format(host, port)\n # Verify previous fragment is used and not the original.\n- assert r.url == 'http://{0}:{1}/final-url/#relevant-section'.format(host, port)\n+ assert r.url == 'http://{}:{}/final-url/#relevant-section'.format(host, port)\n \n close_server.set()"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 6,
+ "changes": 12,
+ "patch": "@@ -158,7 +158,7 @@ def test_mixed_case_scheme_acceptable(self, httpbin, scheme):\n url = scheme + parts.netloc + parts.path\n r = requests.Request('GET', url)\n r = s.send(r.prepare())\n- assert r.status_code == 200, 'failed for scheme {0}'.format(scheme)\n+ assert r.status_code == 200, 'failed for scheme {}'.format(scheme)\n \n def test_HTTP_200_OK_GET_ALTERNATIVE(self, httpbin):\n r = requests.Request('GET', httpbin('get'))\n@@ -816,17 +816,17 @@ def test_invalid_ca_certificate_path(self, httpbin_secure):\n INVALID_PATH = '/garbage'\n with pytest.raises(IOError) as e:\n requests.get(httpbin_secure(), verify=INVALID_PATH)\n- assert str(e.value) == 'Could not find a suitable TLS CA certificate bundle, invalid path: {0}'.format(INVALID_PATH)\n+ assert str(e.value) == 'Could not find a suitable TLS CA certificate bundle, invalid path: {}'.format(INVALID_PATH)\n \n def test_invalid_ssl_certificate_files(self, httpbin_secure):\n INVALID_PATH = '/garbage'\n with pytest.raises(IOError) as e:\n requests.get(httpbin_secure(), cert=INVALID_PATH)\n- assert str(e.value) == 'Could not find the TLS certificate file, invalid path: {0}'.format(INVALID_PATH)\n+ assert str(e.value) == 'Could not find the TLS certificate file, invalid path: {}'.format(INVALID_PATH)\n \n with pytest.raises(IOError) as e:\n requests.get(httpbin_secure(), cert=('.', INVALID_PATH))\n- assert str(e.value) == 'Could not find the TLS key file, invalid path: {0}'.format(INVALID_PATH)\n+ assert str(e.value) == 'Could not find the TLS key file, invalid path: {}'.format(INVALID_PATH)\n \n def test_http_with_certificate(self, httpbin):\n r = requests.get(httpbin(), cert='.')\n@@ -864,7 +864,7 @@ def test_certificate_failure(self, httpbin_secure):\n \n def test_urlencoded_get_query_multivalued_param(self, httpbin):\n \n- r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))\n+ r = requests.get(httpbin('get'), params={'test': ['foo', 'baz']})\n assert r.status_code == 200\n assert r.url == httpbin('get?test=foo&test=baz')\n \n@@ -1458,7 +1458,7 @@ def test_params_are_merged_case_sensitive(self, httpbin):\n assert r.json()['args'] == {'foo': 'bar', 'FOO': 'bar'}\n \n def test_long_authinfo_in_url(self):\n- url = 'http://{0}:{1}@{2}:9000/path?query#frag'.format(\n+ url = 'http://{}:{}@{}:9000/path?query#frag'.format(\n 'E8A3BE87-9E3F-4620-8858-95478E385B5B',\n 'EA770032-DA4D-4D84-8CE9-29C6D910BF1E',\n 'exactly-------------sixty-----------three------------characters',"
+ },
+ {
+ "filename": "tests/test_testserver.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -50,7 +50,7 @@ def test_text_response(self):\n )\n \n with server as (host, port):\n- r = requests.get('http://{0}:{1}'.format(host, port))\n+ r = requests.get('http://{}:{}'.format(host, port))\n \n assert r.status_code == 200\n assert r.text == u'roflol'\n@@ -59,7 +59,7 @@ def test_text_response(self):\n def test_basic_response(self):\n \"\"\"the basic response server returns an empty http response\"\"\"\n with Server.basic_response_server() as (host, port):\n- r = requests.get('http://{0}:{1}'.format(host, port))\n+ r = requests.get('http://{}:{}'.format(host, port))\n assert r.status_code == 200\n assert r.text == u''\n assert r.headers['Content-Length'] == '0'\n@@ -83,7 +83,7 @@ def test_multiple_requests(self):\n server = Server.basic_response_server(requests_to_handle=requests_to_handle)\n \n with server as (host, port):\n- server_url = 'http://{0}:{1}'.format(host, port)\n+ server_url = 'http://{}:{}'.format(host, port)\n for _ in range(requests_to_handle):\n r = requests.get(server_url)\n assert r.status_code == 200"
+ },
+ {
+ "filename": "tests/test_utils.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -665,7 +665,7 @@ def test_add_dict_to_cookiejar(cookiejar):\n cookiedict = {'test': 'cookies',\n 'good': 'cookies'}\n cj = add_dict_to_cookiejar(cookiejar, cookiedict)\n- cookies = dict((cookie.name, cookie.value) for cookie in cj)\n+ cookies = {cookie.name: cookie.value for cookie in cj}\n assert cookiedict == cookies"
+ },
+ {
+ "filename": "tox.ini",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1,5 +1,5 @@\n [tox]\n-envlist = py26,py27,py34,py35,py36\n+envlist = py27,py34,py35,py36\n \n [testenv]"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 165709363,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-10-17T15:56:29+00:00"
+ },
+ {
+ "id": 165739089,
+ "user": "user_b08fb5f52ea1",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-10-17T17:04:04+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 225992828,
+ "user": "user_dbf2a999bd6d",
+ "body": "We'll need to update the date here before merging.",
+ "path": "HISTORY.md",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-10-17T15:56:29+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "ini",
+ "md",
+ "py",
+ "rst"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "DISMISSED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": false,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "46982b049c80f2a2",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.502128+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4805,
+ "title": "Prefer https:// for URLs throughout project",
+ "body": null,
+ "author": "user_278727a2e287",
+ "created_at": "2018-09-23T20:56:44+00:00",
+ "merged_at": "2018-10-01T00:27:24+00:00",
+ "base_branch": "master",
+ "head_branch": "https",
+ "additions": 90,
+ "deletions": 90,
+ "changed_files": 20,
+ "files": [
+ {
+ "filename": "HISTORY.md",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -646,7 +646,7 @@ documentation](http://docs.python-requests.org/en/latest/community/release-proce\n **Bugfixes**\n \n - Revert changes to our vendored certificate bundle. For more context\n- see (\\#2455, \\#2456, and )\n+ see (\\#2455, \\#2456, and )\n \n 2.5.2 (2015-02-23)\n ------------------"
+ },
+ {
+ "filename": "LICENSE",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -4,7 +4,7 @@ Copyright 2018 [NAME_REDACTED] not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n- http://www.apache.org/licenses/LICENSE-2.0\n+ https://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by [NAME_REDACTED] to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,"
+ },
+ {
+ "filename": "_appveyor/install.ps1",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -226,4 +226,4 @@ function main () {\n InstallPip $env:PYTHON\n }\n \n-main\n\\ No newline at end of file\n+main"
+ },
+ {
+ "filename": "appveyor.yml",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -1,5 +1,5 @@\n # AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo\n-# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/\n+# License: CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/\n \n build: off\n \n@@ -31,7 +31,7 @@ environment:\n TOXENV: \"py37\"\n \n install:\n- # [NAME_REDACTED] (from the official .msi of http://python.org) and pip when\n+ # [NAME_REDACTED] (from the official .msi of https://www.python.org/) and pip when\n # not already installed.\n - ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\\install.ps1 }"
+ },
+ {
+ "filename": "docs/_templates/sidebarintro.html",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 6,
+ "changes": 12,
+ "patch": "@@ -25,17 +25,17 @@ [NAME_REDACTED] \n allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"200\" height=\"20\">
\n \n
\n-[NAME_REDACTED] .
\n+[NAME_REDACTED] .
\n [NAME_REDACTED] \n \n-More [NAME_REDACTED] projects:
\n+More [NAME_REDACTED] projects:
\n \n- Requests-HTML \n+ Requests-HTML \n howtopython.org \n pipenv \n- pep8.org \n- httpbin.org \n- The Python Guide \n+ pep8.org \n+ httpbin.org \n+ The Python Guide \n Maya: Datetimes for Humans \n Records: SQL for Humans \n Legit: Git for Humans "
+ },
+ {
+ "filename": "docs/_templates/sidebarlogo.html",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 6,
+ "changes": 12,
+ "patch": "@@ -20,7 +20,7 @@\n [NAME_REDACTED] \n Receive updates on new releases and upcoming projects.
\n \n-[NAME_REDACTED] .
\n+[NAME_REDACTED] .
\n \n \n \n@@ -34,14 +34,14 @@ [NAME_REDACTED] \n \n [NAME_REDACTED] \n \n-More [NAME_REDACTED] projects:
\n+More [NAME_REDACTED] projects:
\n \n- Requests-HTML \n+ Requests-HTML \n howtopython.org \n pipenv \n- pep8.org \n- httpbin.org \n- The Python Guide \n+ pep8.org \n+ httpbin.org \n+ The Python Guide \n Maya: Datetimes for Humans \n Records: SQL for Humans \n Legit: Git for Humans "
+ },
+ {
+ "filename": "docs/api.rst",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 5,
+ "changes": 10,
+ "patch": "@@ -139,7 +139,7 @@ API Changes\n s = requests.Session() # formerly, session took parameters\n s.auth = auth\n s.headers.update(headers)\n- r = s.get('http://httpbin.org/headers')\n+ r = s.get('https://httpbin.org/headers')\n \n * All request hooks have been removed except 'response'.\n \n@@ -185,7 +185,7 @@ API Changes\n requests_log.setLevel(logging.DEBUG)\n requests_log.propagate = True\n \n- requests.get('http://httpbin.org/headers')\n+ requests.get('https://httpbin.org/headers')\n \n \n \n@@ -197,8 +197,8 @@ license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0\n license ensures that contributions to Requests are also covered by [NAME_REDACTED]\n 2.0 license.\n \n-.. _ISC: http://opensource.org/licenses/ISC\n-.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0\n+.. _ISC: https://opensource.org/licenses/ISC\n+.. _Apache 2.0: https://opensource.org/licenses/Apache-2.0\n \n \n Migrating to 2.x\n@@ -213,7 +213,7 @@ For more details on the changes in this release including new APIs, links\n to the relevant GitHub issues and some of the bug fixes, read Cory's blog_\n on the subject.\n \n-.. _blog: http://lukasa.co.uk/2013/09/Requests_20/\n+.. _blog: https://lukasa.co.uk/2013/09/Requests_20/\n \n \n API Changes"
+ },
+ {
+ "filename": "docs/community/out-there.rst",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 5,
+ "changes": 10,
+ "patch": "@@ -15,10 +15,10 @@ To give it a try, simply::\n \n Articles & Talks\n ================\n-- `Python for the Web `_ teaches how to use Python to interact with the web, using Requests.\n-- `[NAME_REDACTED] of Requests `_\n-- `My 'Python for Humans' talk `_ ( `audio `_ )\n+- `Python for the Web `_ teaches how to use Python to interact with the web, using Requests.\n+- `[NAME_REDACTED] of Requests `_\n+- `My 'Python for Humans' talk `_ ( `audio `_ )\n - `[NAME_REDACTED] '[NAME_REDACTED] APIs' talk `_\n-- `Blog post about Requests via Yum `_\n-- `Russian blog post introducing Requests `_\n+- `Blog post about Requests via Yum `_\n+- `Russian blog post introducing Requests `_\n - `Sending JSON in Requests `_"
+ },
+ {
+ "filename": "docs/dev/contributing.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -157,7 +157,7 @@ model methods (e.g. ``__repr__``) are typically the exception to this rule.\n \n Thanks for helping to make the world a better place!\n \n-.. _PEP 8: http://pep8.org\n+.. _PEP 8: https://pep8.org/\n .. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation\n \n Documentation Contributions"
+ },
+ {
+ "filename": "docs/dev/philosophy.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -9,7 +9,7 @@ Requests is an open but opinionated library, created by [NAME_REDACTED]\n [NAME_REDACTED]\n ~~~~~~~~~~~~~~~~\n \n-`[NAME_REDACTED] `_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.\n+`[NAME_REDACTED] `_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.\n \n `[NAME_REDACTED] `_ and `[NAME_REDACTED] `_ are the core contributors. They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library. The day-to-day managing of the project is done by [NAME_REDACTED] are responsible for making judgements about whether or not a feature request is likely to be accepted by Kenneth. Their word is, in some ways, more final than Kenneth's.\n \n@@ -26,7 +26,7 @@ [NAME_REDACTED] many years, the open source community has been plagued with version number dystonia. Numbers vary so greatly from project to project, they are practically meaningless.\n \n-Requests uses `[NAME_REDACTED] `_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.\n+Requests uses `[NAME_REDACTED] `_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.\n \n [NAME_REDACTED]?\n ~~~~~~~~~~~~~~~~~"
+ },
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 21,
+ "deletions": 21,
+ "changes": 42,
+ "patch": "@@ -25,8 +25,8 @@ Let's persist some cookies across requests::\n \n s = requests.Session()\n \n- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')\n- r = s.get('http://httpbin.org/cookies')\n+ s.get('https://httpbin.org/cookies/set/sessioncookie/123456789')\n+ r = s.get('https://httpbin.org/cookies')\n \n print(r.text)\n # '{\"cookies\": {\"sessioncookie\": \"123456789\"}}'\n@@ -40,7 +40,7 @@ is done by [NAME_REDACTED] properties on a Session object::\n s.headers.update({'x-test': 'true'})\n \n # both 'x-test' and 'x-test2' are sent\n- s.get('http://httpbin.org/headers', headers={'x-test2': 'true'})\n+ s.get('https://httpbin.org/headers', headers={'x-test2': 'true'})\n \n \n Any dictionaries that you pass to a request method will be merged with the\n@@ -53,11 +53,11 @@ with the first request, but not the second::\n \n s = requests.Session()\n \n- r = s.get('http://httpbin.org/cookies', cookies={'from-my': 'browser'})\n+ r = s.get('https://httpbin.org/cookies', cookies={'from-my': 'browser'})\n print(r.text)\n # '{\"cookies\": {\"from-my\": \"browser\"}}'\n \n- r = s.get('http://httpbin.org/cookies')\n+ r = s.get('https://httpbin.org/cookies')\n print(r.text)\n # '{\"cookies\": {}}'\n \n@@ -69,7 +69,7 @@ If you want to manually add cookies to your session, use the\n Sessions can also be used as context managers::\n \n with requests.Session() as s:\n- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')\n+ s.get('https://httpbin.org/cookies/set/sessioncookie/123456789')\n \n This will make sure the session is closed as soon as the ``with`` block is\n exited, even if unhandled exceptions occurred.\n@@ -97,7 +97,7 @@ The ``Response`` object contains all of the information returned by [NAME_REDACTED] a\n also contains the ``Request`` object you created originally. Here is a simple\n request to get some very important information from Wikipedia's servers::\n \n- >>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python')\n+ >>> r = requests.get('https://en.wikipedia.org/wiki/Monty_Python')\n \n If we want to access the headers the server sent back to us, we do this::\n \n@@ -323,7 +323,7 @@ inefficiency with connections. If you find yourself partially reading request\n bodies (or not reading them at all) while using ``stream=True``, you should\n make the request within a ``with`` statement to ensure it's always closed::\n \n- with requests.get('http://httpbin.org/get', stream=True) as r:\n+ with requests.get('https://httpbin.org/get', stream=True) as r:\n # Do things with the response here.\n \n .. _keep-alive:\n@@ -393,7 +393,7 @@ upload image files to an HTML form with a multiple file field 'images'::\n \n To do that, just set files to a list of tuples of ``(form_field_name, file_info)``::\n \n- >>> url = 'http://httpbin.org/post'\n+ >>> url = 'https://httpbin.org/post'\n >>> multiple_files = [\n ('images', ('foo.png', open('foo.png', 'rb'), 'image/png')),\n ('images', ('bar.png', open('bar.png', 'rb'), 'image/png'))]\n@@ -455,13 +455,13 @@ anything, nothing else is affected.\n \n Let's print some request method arguments at runtime::\n \n- >>> requests.get('http://httpbin.org', hooks={'response': print_url})\n- http://httpbin.org\n+ >>> requests.get('https://httpbin.org/', hooks={'response': print_url})\n+ https://httpbin.org/\n \n \n You can add multiple hooks to a single request. Let's call two hooks at once::\n \n- >>> r = requests.get('http://httpbin.org', hooks={'response': [print_url, record_hook]})\n+ >>> r = requests.get('https://httpbin.org/', hooks={'response': [print_url, record_hook]})\n >>> r.hook_called\n True\n \n@@ -470,8 +470,8 @@ be called on every request made to the session. For example::\n \n >>> s = requests.Session()\n >>> s.hooks['response'].append(print_url)\n- >>> s.get('http://httpbin.org')\n- http://httpbin.org\n+ >>> s.get('https://httpbin.org/')\n+ https://httpbin.org/\n \n \n A ``Session`` can have multiple hooks, which will be called in the order\n@@ -529,7 +529,7 @@ set ``stream`` to ``True`` and iterate over the response with\n import json\n import requests\n \n- r = requests.get('http://httpbin.org/stream/20', stream=True)\n+ r = requests.get('https://httpbin.org/stream/20', stream=True)\n \n for line in r.iter_lines():\n \n@@ -543,7 +543,7 @@ When using `decode_unicode=True` with\n :meth:`Response.iter_content() `, you'll want\n to provide a fallback encoding in the event the server doesn't provide one::\n \n- r = requests.get('http://httpbin.org/stream/20', stream=True)\n+ r = requests.get('https://httpbin.org/stream/20', stream=True)\n \n if r.encoding is None:\n r.encoding = 'utf-8'\n@@ -657,7 +657,7 @@ encoding in the HTTP header, and if none is present, will use `chardet\n The only time Requests will not do this is if no explicit charset\n is present in the HTTP headers **and** the ``Content-Type``\n header contains ``text``. In this situation, `RFC 2616\n-`_ specifies\n+`_ specifies\n that the default charset must be ``ISO-8859-1``. Requests follows the\n specification in this case. If you require a different encoding, you can\n manually set the :attr:`Response.encoding `\n@@ -921,7 +921,7 @@ it should apply to.\n ::\n \n >>> s = requests.Session()\n- >>> s.mount('http://www.github.com', MyAdapter())\n+ >>> s.mount('https://github.com/', MyAdapter())\n \n The mount call registers a specific instance of a [NAME_REDACTED] to a\n prefix. Once mounted, any HTTP request made using that session whose URL starts\n@@ -959,7 +959,7 @@ library to use SSLv3::\n num_pools=connections, maxsize=maxsize,\n block=block, ssl_version=ssl.PROTOCOL_SSLv3)\n \n-.. _`described here`: http://www.kennethreitz.org/essays/the-future-of-python-http\n+.. _`described here`: https://www.kennethreitz.org/essays/the-future-of-python-http\n .. _`urllib3`: https://github.com/shazow/urllib3\n \n .. _blocking-or-nonblocking:\n@@ -1003,7 +1003,7 @@ The **connect** timeout is the number of seconds Requests will wait for your\n client to establish a connection to a remote machine (corresponding to the\n `connect()`_) call on the socket. It's a good practice to set connect timeouts\n to slightly larger than a multiple of 3, which is the default `TCP packet\n-retransmission window `_.\n+retransmission window `_.\n \n Once your client has connected to the server and sent the HTTP request, the\n **read** timeout is the number of seconds the client will wait for the server\n@@ -1028,4 +1028,4 @@ coffee.\n \n r = requests.get('https://github.com', timeout=None)\n \n-.. _`connect()`: http://linux.die.net/man/2/connect\n+.. _`connect()`: https://linux.die.net/man/2/connect"
+ },
+ {
+ "filename": "docs/user/authentication.rst",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -53,7 +53,7 @@ Another very popular form of HTTP Authentication is [NAME_REDACTED],\n and Requests supports this out of the box as well::\n \n >>> from requests.auth import HTTPDigestAuth\n- >>> url = 'http://httpbin.org/digest-auth/auth/user/pass'\n+ >>> url = 'https://httpbin.org/digest-auth/auth/user/pass'\n >>> requests.get(url, auth=HTTPDigestAuth('user', 'pass'))\n \n \n@@ -122,7 +122,7 @@ To do so, subclass :class:`AuthBase ` and implement the\n ... # Implement my authentication\n ... return r\n ...\n- >>> url = 'http://httpbin.org/get'\n+ >>> url = 'https://httpbin.org/get'\n >>> requests.get(url, auth=MyAuth())\n \n \n@@ -134,7 +134,7 @@ authentication will additionally add hooks to provide further functionality.\n Further examples can be found under the `Requests organization`_ and in the\n ``auth.py`` file.\n \n-.. _OAuth: http://oauth.net/\n+.. _OAuth: https://oauth.net/\n .. _requests_oauthlib: https://github.com/requests/requests-oauthlib\n .. _requests-oauthlib OAuth2 documentation: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html\n .. _Web [NAME_REDACTED]: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow"
+ },
+ {
+ "filename": "docs/user/install.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -18,7 +18,7 @@ To install Requests, simply run this simple command in your terminal of choice::\n $ pipenv install requests\n \n If you don't have `pipenv `_ installed (tisk tisk!), head over to the Pipenv website for installation instructions. Or, if you prefer to just use pip and don't have it installed,\n-`this Python installation guide `_\n+`this Python installation guide `_\n can guide you through the process.\n \n Get the [NAME_REDACTED]"
+ },
+ {
+ "filename": "docs/user/intro.rst",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -37,8 +37,8 @@ closed-source software.\n \n Requests is released under terms of `Apache2 License`_.\n \n-.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php\n-.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0\n+.. _`GPL Licensed`: https://opensource.org/licenses/gpl-license.php\n+.. _`Apache2 License`: https://opensource.org/licenses/Apache-2.0\n \n \n [NAME_REDACTED]"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 25,
+ "deletions": 25,
+ "changes": 50,
+ "patch": "@@ -39,15 +39,15 @@ get all the information we need from this object.\n Requests' simple API means that all forms of HTTP request are as obvious. For\n example, this is how you make an HTTP POST request::\n \n- >>> r = requests.post('http://httpbin.org/post', data = {'key':'value'})\n+ >>> r = requests.post('https://httpbin.org/post', data = {'key':'value'})\n \n Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and\n OPTIONS? These are all just as simple::\n \n- >>> r = requests.put('http://httpbin.org/put', data = {'key':'value'})\n- >>> r = requests.delete('http://httpbin.org/delete')\n- >>> r = requests.head('http://httpbin.org/get')\n- >>> r = requests.options('http://httpbin.org/get')\n+ >>> r = requests.put('https://httpbin.org/put', data = {'key':'value'})\n+ >>> r = requests.delete('https://httpbin.org/delete')\n+ >>> r = requests.head('https://httpbin.org/get')\n+ >>> r = requests.options('https://httpbin.org/get')\n \n That's all well and good, but it's also only the start of what Requests can\n do.\n@@ -65,12 +65,12 @@ using the ``params`` keyword argument. As an example, if you wanted to pass\n following code::\n \n >>> payload = {'key1': 'value1', 'key2': 'value2'}\n- >>> r = requests.get('http://httpbin.org/get', params=payload)\n+ >>> r = requests.get('https://httpbin.org/get', params=payload)\n \n You can see that the URL has been correctly encoded by [NAME_REDACTED]::\n \n >>> print(r.url)\n- http://httpbin.org/get?key2=value2&key1=value1\n+ https://httpbin.org/get?key2=value2&key1=value1\n \n Note that any dictionary key whose value is ``None`` will not be added to the\n URL's query string.\n@@ -79,9 +79,9 @@ You can also pass a list of items as a value::\n \n >>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}\n \n- >>> r = requests.get('http://httpbin.org/get', params=payload)\n+ >>> r = requests.get('https://httpbin.org/get', params=payload)\n >>> print(r.url)\n- http://httpbin.org/get?key1=value1&key2=value2&key2=value3\n+ https://httpbin.org/get?key1=value1&key2=value2&key2=value3\n \n [NAME_REDACTED]\n ----------------\n@@ -233,7 +233,7 @@ dictionary of data will automatically be form-encoded when the request is made::\n \n >>> payload = {'key1': 'value1', 'key2': 'value2'}\n \n- >>> r = requests.post(\"http://httpbin.org/post\", data=payload)\n+ >>> r = requests.post(\"https://httpbin.org/post\", data=payload)\n >>> print(r.text)\n {\n ...\n@@ -250,9 +250,9 @@ as values. This is particularly useful when the form has multiple elements that\n use the same key::\n \n >>> payload_tuples = [('key1', 'value1'), ('key1', 'value2')]\n- >>> r1 = requests.post('http://httpbin.org/post', data=payload_tuples)\n+ >>> r1 = requests.post('https://httpbin.org/post', data=payload_tuples)\n >>> payload_dict = {'key1': ['value1', 'value2']}\n- >>> r2 = requests.post('http://httpbin.org/post', data=payload_dict)\n+ >>> r2 = requests.post('https://httpbin.org/post', data=payload_dict)\n >>> print(r1.text)\n {\n ...\n@@ -296,7 +296,7 @@ POST a [NAME_REDACTED] makes it simple to upload Multipart-encoded files::\n \n- >>> url = 'http://httpbin.org/post'\n+ >>> url = 'https://httpbin.org/post'\n >>> files = {'file': open('report.xls', 'rb')}\n \n >>> r = requests.post(url, files=files)\n@@ -311,7 +311,7 @@ Requests makes it simple to upload Multipart-encoded files::\n \n You can set the filename, content_type and headers explicitly::\n \n- >>> url = 'http://httpbin.org/post'\n+ >>> url = 'https://httpbin.org/post'\n >>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}\n \n >>> r = requests.post(url, files=files)\n@@ -326,7 +326,7 @@ You can set the filename, content_type and headers explicitly::\n \n If you want, you can send strings to be received as files::\n \n- >>> url = 'http://httpbin.org/post'\n+ >>> url = 'https://httpbin.org/post'\n >>> files = {'file': ('report.csv', 'some,data,to,send\\nanother,row,to,send\\n')}\n \n >>> r = requests.post(url, files=files)\n@@ -360,7 +360,7 @@ [NAME_REDACTED]\n \n We can check the response status code::\n \n- >>> r = requests.get('http://httpbin.org/get')\n+ >>> r = requests.get('https://httpbin.org/get')\n >>> r.status_code\n 200\n \n@@ -374,7 +374,7 @@ If we made a bad request (a 4XX client error or 5XX server error response), we\n can raise it with\n :meth:`Response.raise_for_status() `::\n \n- >>> bad_r = requests.get('http://httpbin.org/status/404')\n+ >>> bad_r = requests.get('https://httpbin.org/status/404')\n >>> bad_r.status_code\n 404\n \n@@ -410,7 +410,7 @@ We can view the server's response headers using a Python dictionary::\n }\n \n The dictionary is special, though: it's made just for HTTP headers. According to\n-`RFC 7230 `_, HTTP Header names\n+`RFC 7230 `_, HTTP Header names\n are case-insensitive.\n \n So, we can access the headers using any capitalization we want::\n@@ -424,7 +424,7 @@ So, we can access the headers using any capitalization we want::\n It is also special in that the server could have sent the same header multiple\n times with different values, but requests combines them so they can be\n represented in the dictionary within a single mapping, as per\n-`RFC 7230 `_:\n+`RFC 7230 `_:\n \n A recipient MAY combine multiple header fields with the same field name\n into one \"field-name: field-value\" pair, without changing the semantics\n@@ -445,7 +445,7 @@ If a response contains some Cookies, you can quickly access them::\n To send your own cookies to the server, you can use the ``cookies``\n parameter::\n \n- >>> url = 'http://httpbin.org/cookies'\n+ >>> url = 'https://httpbin.org/cookies'\n >>> cookies = dict(cookies_are='working')\n \n >>> r = requests.get(url, cookies=cookies)\n@@ -460,7 +460,7 @@ also be passed in to requests::\n >>> jar = requests.cookies.RequestsCookieJar()\n >>> jar.set('tasty_cookie', 'yum', domain='httpbin.org', path='/cookies')\n >>> jar.set('gross_cookie', 'blech', domain='httpbin.org', path='/elsewhere')\n- >>> url = 'http://httpbin.org/cookies'\n+ >>> url = 'https://httpbin.org/cookies'\n >>> r = requests.get(url, cookies=jar)\n >>> r.text\n '{\"cookies\": {\"tasty_cookie\": \"yum\"}}'\n@@ -481,7 +481,7 @@ response.\n \n For example, GitHub redirects all HTTP requests to HTTPS::\n \n- >>> r = requests.get('http://github.com')\n+ >>> r = requests.get('https://github.com/')\n \n >>> r.url\n 'https://github.com/'\n@@ -496,7 +496,7 @@ For example, GitHub redirects all HTTP requests to HTTPS::\n If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable\n redirection handling with the ``allow_redirects`` parameter::\n \n- >>> r = requests.get('http://github.com', allow_redirects=False)\n+ >>> r = requests.get('https://github.com/', allow_redirects=False)\n \n >>> r.status_code\n 301\n@@ -506,7 +506,7 @@ redirection handling with the ``allow_redirects`` parameter::\n \n If you're using HEAD, you can enable redirection as well::\n \n- >>> r = requests.head('http://github.com', allow_redirects=True)\n+ >>> r = requests.head('https://github.com/', allow_redirects=True)\n \n >>> r.url\n 'https://github.com/'\n@@ -523,7 +523,7 @@ seconds with the ``timeout`` parameter. Nearly all production code should use\n this parameter in nearly all requests. Failure to do so can cause your program\n to hang indefinitely::\n \n- >>> requests.get('http://github.com', timeout=0.001)\n+ >>> requests.get('https://github.com/', timeout=0.001)\n Traceback (most recent call last):\n File \"\", line 1, in \n requests.exceptions.Timeout: HTTPConnectionPool(host='github.com', port=80): Request timed out. (timeout=0.001)"
+ },
+ {
+ "filename": "requests/__init__.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -22,7 +22,7 @@\n ... or POST:\n \n >>> payload = dict(key1='value1', key2='value2')\n- >>> r = requests.post('http://httpbin.org/post', data=payload)\n+ >>> r = requests.post('https://httpbin.org/post', data=payload)\n >>> print(r.text)\n {\n ..."
+ },
+ {
+ "filename": "requests/api.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -49,7 +49,7 @@ def request(method, url, **kwargs):\n Usage::\n \n >>> import requests\n- >>> req = requests.request('GET', 'http://httpbin.org/get')\n+ >>> req = requests.request('GET', 'https://httpbin.org/get')\n \n \"\"\""
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -218,7 +218,7 @@ class Request(RequestHooksMixin):\n Usage::\n \n >>> import requests\n- >>> req = requests.Request('GET', 'http://httpbin.org/get')\n+ >>> req = requests.Request('GET', 'https://httpbin.org/get')\n >>> req.prepare()\n \n \"\"\"\n@@ -278,7 +278,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):\n Usage::\n \n >>> import requests\n- >>> req = requests.Request('GET', 'http://httpbin.org/get')\n+ >>> req = requests.Request('GET', 'https://httpbin.org/get')\n >>> r = req.prepare()\n "
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 3,
+ "changes": 6,
+ "patch": "@@ -311,7 +311,7 @@ def rebuild_method(self, prepared_request, response):\n \"\"\"\n method = prepared_request.method\n \n- # http://tools.ietf.org/html/rfc7231#section-6.4.4\n+ # https://tools.ietf.org/html/rfc7231#section-6.4.4\n if response.status_code == codes.see_other and method != 'HEAD':\n method = 'GET'\n \n@@ -337,13 +337,13 @@ class Session(SessionRedirectMixin):\n \n >>> import requests\n >>> s = requests.Session()\n- >>> s.get('http://httpbin.org/get')\n+ >>> s.get('https://httpbin.org/get')\n \n \n Or as a context manager::\n \n >>> with requests.Session() as s:\n- >>> s.get('http://httpbin.org/get')\n+ >>> s.get('https://httpbin.org/get')\n \n \"\"\""
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -176,7 +176,7 @@ def get_netrc_auth(url, raise_errors=False):\n loc = os.path.expanduser('~/{0}'.format(f))\n except KeyError:\n # os.path.expanduser can fail when $HOME is undefined and\n- # getpwuid fails. See http://bugs.python.org/issue20164 &\n+ # getpwuid fails. See https://bugs.python.org/issue20164 &\n # https://github.com/requests/requests/issues/1846\n return"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 160126772,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Looks like a couple examples may be broken. I left comments on the two I had a concern about. Once those are addressed and we get this rebased onto master, I think this is set for merge.",
+ "submitted_at": "2018-09-30T20:13:22+00:00"
+ },
+ {
+ "id": 160134594,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Cool, I think this looks good. Thanks [USER_REDACTED]! ✨",
+ "submitted_at": "2018-10-01T00:22:36+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 221471744,
+ "user": "user_dbf2a999bd6d",
+ "body": "Why was this removed?",
+ "path": "docs/user/advanced.rst",
+ "line": 28,
+ "side": "LEFT",
+ "created_at": "2018-09-30T20:08:36+00:00"
+ },
+ {
+ "id": 221471753,
+ "user": "user_dbf2a999bd6d",
+ "body": "Same question here.",
+ "path": "docs/user/advanced.rst",
+ "line": 72,
+ "side": "LEFT",
+ "created_at": "2018-09-30T20:08:56+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "html",
+ "md",
+ "ps1",
+ "py",
+ "rst",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "07dd6f4d43d35451",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.504127+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4766,
+ "title": "Fix several ResourceWarnings in test_requests.py",
+ "body": "Hello,\n\nI do not know if you are interested in fixing `ResourceWarning`s in tests, but I will take my chance :)\nThere was 10 unclosed files in `test_requests.py`.",
+ "author": "user_3fa56c93af17",
+ "created_at": "2018-08-13T19:11:49+00:00",
+ "merged_at": "2022-05-11T01:04:18+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-resource-warnings",
+ "additions": 44,
+ "deletions": 38,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 44,
+ "deletions": 38,
+ "changes": 82,
+ "patch": "@@ -1022,12 +1022,13 @@ def test_form_encoded_post_query_multivalued_element(self, httpbin):\n assert prep.body == \"test=foo&test=baz\"\n \n def test_different_encodings_dont_break_post(self, httpbin):\n- r = requests.post(\n- httpbin(\"post\"),\n- data={\"stuff\": json.dumps({\"a\": 123})},\n- params={\"blah\": \"asdf1234\"},\n- files={\"file\": (\"test_requests.py\", open(__file__, \"rb\"))},\n- )\n+ with open(__file__, \"rb\") as f:\n+ r = requests.post(\n+ httpbin(\"post\"),\n+ data={\"stuff\": json.dumps({\"a\": 123})},\n+ params={\"blah\": \"asdf1234\"},\n+ files={\"file\": (\"test_requests.py\", f)},\n+ )\n assert r.status_code == 200\n \n [USER_REDACTED].mark.parametrize(\n@@ -1040,35 +1041,44 @@ def test_different_encodings_dont_break_post(self, httpbin):\n ),\n )\n def test_unicode_multipart_post(self, httpbin, data):\n- r = requests.post(\n- httpbin(\"post\"),\n- data=data,\n- files={\"file\": (\"test_requests.py\", open(__file__, \"rb\"))},\n- )\n+ with open(__file__, \"rb\") as f:\n+ r = requests.post(\n+ httpbin(\"post\"),\n+ data=data,\n+ files={\"file\": (\"test_requests.py\", f)},\n+ )\n assert r.status_code == 200\n \n def test_unicode_multipart_post_fieldnames(self, httpbin):\n filename = os.path.splitext(__file__)[0] + \".py\"\n- r = requests.Request(\n- method=\"POST\",\n- url=httpbin(\"post\"),\n- data={b\"stuff\": \"elixr\"},\n- files={\"file\": (\"test_requests.py\", open(filename, \"rb\"))},\n- )\n- prep = r.prepare()\n+ with open(filename, \"rb\") as f:\n+ r = requests.Request(\n+ method=\"POST\",\n+ url=httpbin(\"post\"),\n+ data={b\"stuff\": \"elixr\"},\n+ files={\"file\": (\"test_requests.py\", f)},\n+ )\n+ prep = r.prepare()\n+\n assert b'name=\"stuff\"' in prep.body\n assert b\"name=\\\"b'stuff'\\\"\" not in prep.body\n \n def test_unicode_method_name(self, httpbin):\n- files = {\"file\": open(__file__, \"rb\")}\n- r = requests.request(method=\"POST\", url=httpbin(\"post\"), files=files)\n+ with open(__file__, \"rb\") as f:\n+ files = {\"file\": f}\n+ r = requests.request(\n+ method=\"POST\",\n+ url=httpbin(\"post\"),\n+ files=files,\n+ )\n assert r.status_code == 200\n \n def test_unicode_method_name_with_request_object(self, httpbin):\n- files = {\"file\": open(__file__, \"rb\")}\n s = requests.Session()\n- req = requests.Request(\"POST\", httpbin(\"post\"), files=files)\n- prep = s.prepare_request(req)\n+ with open(__file__, \"rb\") as f:\n+ files = {\"file\": f}\n+ req = requests.Request(\"POST\", httpbin(\"post\"), files=files)\n+ prep = s.prepare_request(req)\n assert isinstance(prep.method, builtin_str)\n assert prep.method == \"POST\"\n \n@@ -1084,18 +1094,14 @@ def test_non_prepared_request_error(self):\n assert str(e.value) == \"You can only send PreparedRequests.\"\n \n def test_custom_content_type(self, httpbin):\n- r = requests.post(\n- httpbin(\"post\"),\n- data={\"stuff\": json.dumps({\"a\": 123})},\n- files={\n- \"file1\": (\"test_requests.py\", open(__file__, \"rb\")),\n- \"file2\": (\n- \"test_requests\",\n- open(__file__, \"rb\"),\n- \"text/py-content-type\",\n- ),\n- },\n- )\n+ with open(__file__, \"rb\") as f1:\n+ with open(__file__, \"rb\") as f2:\n+ data={\"stuff\": json.dumps({\"a\": 123})}\n+ files = {\n+ \"file1\": (\"test_requests.py\", f1),\n+ \"file2\": (\"test_requests\", f2, \"text/py-content-type\"),\n+ }\n+ r = requests.post(httpbin(\"post\"), data=data, files=files)\n assert r.status_code == 200\n assert b\"text/py-content-type\" in r.request.body\n \n@@ -1484,9 +1490,9 @@ def test_prepared_request_is_pickleable(self, httpbin):\n assert resp.status_code == 200\n \n def test_prepared_request_with_file_is_pickleable(self, httpbin):\n- files = {\"file\": open(__file__, \"rb\")}\n- r = requests.Request(\"POST\", httpbin(\"post\"), files=files)\n- p = r.prepare()\n+ with open(__file__, \"rb\") as f:\n+ r = requests.Request(\"POST\", httpbin(\"post\"), files={\"file\": f})\n+ p = r.prepare()\n \n # [NAME_REDACTED] can be pickled and unpickled\n r = pickle.loads(pickle.dumps(p))"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 154914864,
+ "user": "user_d37df7c0baa1",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-09-13T03:07:13+00:00"
+ },
+ {
+ "id": 145869956,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Hi [USER_REDACTED], thanks for looking into this. I don't have an issue adding the context handlers, but we should probably avoid dumping all of the logic inside of them.\n\nIf we want to encourage best practices, let's make sure anything not relevant to the file handler stays at its original indentation. Once that's done, if you can rebase onto master, I think I'm happy with this.",
+ "submitted_at": "2018-09-30T20:31:20+00:00"
+ },
+ {
+ "id": 968559173,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Hi [USER_REDACTED], I've rebased your change onto the top of our main branch and resolved some conflicts. This seems like a reasonable fix still and I think we're happy with its current state. Thanks again for the contribution!",
+ "submitted_at": "2022-05-11T01:03:37+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 209787773,
+ "user": "user_dbf2a999bd6d",
+ "body": "Let’s pull the `assert` out to the same indentation level as `with`.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T23:14:55+00:00"
+ },
+ {
+ "id": 209787806,
+ "user": "user_dbf2a999bd6d",
+ "body": "Same here.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T23:15:10+00:00"
+ },
+ {
+ "id": 221472175,
+ "user": "user_dbf2a999bd6d",
+ "body": "Let's just pass this directly to the `files` parameter.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-09-30T20:23:42+00:00"
+ },
+ {
+ "id": 221472191,
+ "user": "user_dbf2a999bd6d",
+ "body": "We can unindent this to align with `with`.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-09-30T20:24:12+00:00"
+ },
+ {
+ "id": 221472224,
+ "user": "user_dbf2a999bd6d",
+ "body": "These asserts can be done at the same indentation as the `with` block.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-09-30T20:25:23+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "DISMISSED": 1,
+ "CHANGES_REQUESTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 5
+ }
+}
+{
+ "_id": "ab6e05f17a242ca4",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.504585+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4739,
+ "title": "Document that params and data can be list of tuples everywhere",
+ "body": "Fix a few inconsistencies in the doc found while working on [MechanicalSoup](https://github.com/[USER_REDACTED]nicalSoup/MechanicalSoup/pull/219).",
+ "author": "user_bf117c3b02cb",
+ "created_at": "2018-07-13T09:49:48+00:00",
+ "merged_at": "2018-07-17T22:16:03+00:00",
+ "base_branch": "master",
+ "head_branch": "doc-list-of-tuples",
+ "additions": 26,
+ "deletions": 13,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "requests/api.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 6,
+ "changes": 18,
+ "patch": "@@ -18,8 +18,10 @@ def request(method, url, **kwargs):\n \n :param method: method for the new :class:`Request` object.\n :param url: URL for the new :class:`Request` object.\n- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.\n- :param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param params: (optional) Dictionary, list of tuples or bytes to send\n+ in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.\n :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.\n :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.\n@@ -62,7 +64,8 @@ def get(url, params=None, **kwargs):\n r\"\"\"Sends a GET request.\n \n :param url: URL for the new :class:`Request` object.\n- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.\n+ :param params: (optional) Dictionary, list of tuples or bytes to send\n+ in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :return: :class:`Response ` object\n :rtype: requests.Response\n@@ -102,7 +105,8 @@ def post(url, data=None, json=None, **kwargs):\n r\"\"\"Sends a POST request.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) json data to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :return: :class:`Response ` object\n@@ -116,7 +120,8 @@ def put(url, data=None, **kwargs):\n r\"\"\"Sends a PUT request.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) json data to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :return: :class:`Response ` object\n@@ -130,7 +135,8 @@ def patch(url, data=None, **kwargs):\n r\"\"\"Sends a PATCH request.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) json data to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :return: :class:`Response ` object"
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 2,
+ "changes": 8,
+ "patch": "@@ -204,9 +204,13 @@ class Request(RequestHooksMixin):\n :param url: URL to send.\n :param headers: dictionary of headers to send.\n :param files: dictionary of {filename: fileobject} files to multipart upload.\n- :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.\n+ :param data: the body to attach to the request. If a dictionary or\n+ list of tuples ``[(key, value)]`` is provided, form-encoding will\n+ take place.\n :param json: json for the body to attach to the request (if files or data is not specified).\n- :param params: dictionary of URL parameters to append to the URL.\n+ :param params: URL parameters to append to the URL. If a dictionary or\n+ list of tuples ``[(key, value)]`` is provided, form-encoding will\n+ take place.\n :param auth: Auth handler or (user, pass) tuple.\n :param cookies: dictionary or CookieJar of cookies to attach to this request.\n :param hooks: dictionary of callback hooks, for internal usage."
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 5,
+ "changes": 13,
+ "patch": "@@ -453,8 +453,8 @@ def request(self, method, url,\n :param url: URL for the new :class:`Request` object.\n :param params: (optional) Dictionary or bytes to be sent in the query\n string for the :class:`Request`.\n- :param data: (optional) Dictionary, bytes, or file-like object to send\n- in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) json to send in the body of the\n :class:`Request`.\n :param headers: (optional) Dictionary of HTTP Headers to send with the\n@@ -550,7 +550,8 @@ def post(self, url, data=None, json=None, **kwargs):\n r\"\"\"Sends a POST request. Returns :class:`Response` object.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param json: (optional) json to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :rtype: requests.Response\n@@ -562,7 +563,8 @@ def put(self, url, data=None, **kwargs):\n r\"\"\"Sends a PUT request. Returns :class:`Response` object.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :rtype: requests.Response\n \"\"\"\n@@ -573,7 +575,8 @@ def patch(self, url, data=None, **kwargs):\n r\"\"\"Sends a PATCH request. Returns :class:`Response` object.\n \n :param url: URL for the new :class:`Request` object.\n- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.\n+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n+ object to send in the body of the :class:`Request`.\n :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n :rtype: requests.Response\n \"\"\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 137231447,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Hi [USER_REDACTED], thanks for submitting this PR! I think we can make the change on the base `request` method to be consistent between `data` and `params`.\n\nAs for the others, it feels unnecessarily redundant for a smaller edge case. The tuple list is a alternative encapsulation of the dictionary concept that is allowing us to use the same key multiple times, and we have documentation around this in the main docs if needed.",
+ "submitted_at": "2018-07-14T07:22:41+00:00"
+ },
+ {
+ "id": 137278463,
+ "user": "user_bf117c3b02cb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-15T21:11:07+00:00"
+ },
+ {
+ "id": 137278550,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-15T21:14:55+00:00"
+ },
+ {
+ "id": 137279073,
+ "user": "user_bf117c3b02cb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-15T21:36:27+00:00"
+ },
+ {
+ "id": 137865783,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-17T14:47:15+00:00"
+ },
+ {
+ "id": 137869418,
+ "user": "user_bf117c3b02cb",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-17T14:53:58+00:00"
+ },
+ {
+ "id": 138042156,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Ok, I think I’m happy with this. Thanks [USER_REDACTED]!",
+ "submitted_at": "2018-07-17T22:15:36+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 202508571,
+ "user": "user_dbf2a999bd6d",
+ "body": "This can probably be two lines instead of three, following the line length of the other entries.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-14T07:15:43+00:00"
+ },
+ {
+ "id": 202554674,
+ "user": "user_bf117c3b02cb",
+ "body": "To use 2 lines, one needs to cut the ` ``literal`` ` block, and I've seen some RST processor yield incorrect results in this case so I preferred avoiding this cut. I can change it if you prefer.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-15T21:11:07+00:00"
+ },
+ {
+ "id": 202554782,
+ "user": "user_dbf2a999bd6d",
+ "body": "I don’t think we need to cut the literal block. This line is almost identical to the one below it which only occupies a single line.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-15T21:14:55+00:00"
+ },
+ {
+ "id": 202555362,
+ "user": "user_bf117c3b02cb",
+ "body": "Indeed: my text editor wraps at 72 characters so it was cutting in the middle of the literal block. I make lines a bit longer, but in most cases it doesn't change the number of lines. Other docstrings fit on one line because they're e.g. 171 characters long.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-15T21:36:27+00:00"
+ },
+ {
+ "id": 203052167,
+ "user": "user_dbf2a999bd6d",
+ "body": "[USER_REDACTED] yes, so if we split it across two lines it will be < 100 characters per line which is consistent with this projects typical line length.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-17T14:47:15+00:00"
+ },
+ {
+ "id": 203054972,
+ "user": "user_bf117c3b02cb",
+ "body": "I'm a new contributor so I can't talk about the established practices, but the doc says \"Line-length can exceed 79 characters, to 100, when convenient.\", so I understand that I can make an exception to the 79 characters when I have a good reason (\"when convenient\"). I don't see the benefit of making an exception here.",
+ "path": "requests/api.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-17T14:53:58+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 5,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 6,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 6
+ }
+}
+{
+ "_id": "a937d91ad1e5539b",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.504585+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4718,
+ "title": "[NAME_REDACTED] header whenever root URL changes",
+ "body": "Previously the header was stripped only if the hostname changed, but in\nan https -> http redirect that can leak the credentials on the wire\n(#4716). Based on with RFC 7235 section 2.2, the header is now stripped\nif the \"canonical root URL\" (scheme+authority) has changed.\n\nCloses #4716.",
+ "author": "user_44c1846fca70",
+ "created_at": "2018-06-28T14:48:34+00:00",
+ "merged_at": "2018-09-14T12:08:05+00:00",
+ "base_branch": "master",
+ "head_branch": "fix-4716",
+ "additions": 44,
+ "deletions": 11,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 6,
+ "changes": 24,
+ "patch": "@@ -115,6 +115,22 @@ def get_redirect_target(self, resp):\n return to_native_string(location, 'utf8')\n return None\n \n+ def should_strip_auth(self, old_url, new_url):\n+ \"\"\"Decide whether Authorization header should be removed when redirecting\"\"\"\n+ old_parsed = urlparse(old_url)\n+ new_parsed = urlparse(new_url)\n+ if old_parsed.hostname != new_parsed.hostname:\n+ return True\n+ # Special case: allow http -> https redirect when using the standard\n+ # ports. This isn't specified by RFC 7235, but is kept to avoid\n+ # breaking backwards compatibility with older versions of requests\n+ # that allowed any redirects on the same host.\n+ if (old_parsed.scheme == 'http' and old_parsed.port in (80, None)\n+ and new_parsed.scheme == 'https' and new_parsed.port in (443, None)):\n+ return False\n+ # Standard case: root URI must match\n+ return old_parsed.port != new_parsed.port or old_parsed.scheme != new_parsed.scheme\n+\n def resolve_redirects(self, resp, req, stream=False, timeout=None,\n verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):\n \"\"\"Receives a Response. Returns a generator of Responses or Requests.\"\"\"\n@@ -236,14 +252,10 @@ def rebuild_auth(self, prepared_request, response):\n headers = prepared_request.headers\n url = prepared_request.url\n \n- if 'Authorization' in headers:\n+ if 'Authorization' in headers and self.should_strip_auth(response.request.url, url):\n # If we get redirected to a new host, we should strip out any\n # authentication headers.\n- original_parsed = urlparse(response.request.url)\n- redirect_parsed = urlparse(url)\n-\n- if (original_parsed.hostname != redirect_parsed.hostname):\n- del headers['Authorization']\n+ del headers['Authorization']\n \n # .netrc might have more auth for us on our new host.\n new_auth = get_netrc_auth(url) if self.trust_env else None"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 26,
+ "deletions": 5,
+ "changes": 31,
+ "patch": "@@ -1573,15 +1573,15 @@ def test_nonhttp_schemes_dont_check_URLs(self):\n preq = req.prepare()\n assert test_url == preq.url\n \n- [USER_REDACTED].mark.xfail(raises=ConnectionError)\n- def test_auth_is_stripped_on_redirect_off_host(self, httpbin):\n+ def test_auth_is_stripped_on_http_downgrade(self, httpbin, httpbin_secure, httpbin_ca_bundle):\n r = requests.get(\n- httpbin('redirect-to'),\n- params={'url': 'http://www.google.co.uk'},\n+ httpbin_secure('redirect-to'),\n+ params={'url': httpbin('get')},\n auth=('user', 'pass'),\n+ verify=httpbin_ca_bundle\n )\n assert r.history[0].request.headers['Authorization']\n- assert not r.request.headers.get('Authorization', '')\n+ assert 'Authorization' not in r.request.headers\n \n def test_auth_is_retained_for_redirect_on_host(self, httpbin):\n r = requests.get(httpbin('redirect/1'), auth=('user', 'pass'))\n@@ -1590,6 +1590,27 @@ def test_auth_is_retained_for_redirect_on_host(self, httpbin):\n \n assert h1 == h2\n \n+ def test_should_strip_auth_host_change(self):\n+ s = requests.Session()\n+ assert s.should_strip_auth('http://example.com/foo', 'http://another.example.com/')\n+\n+ def test_should_strip_auth_http_downgrade(self):\n+ s = requests.Session()\n+ assert s.should_strip_auth('https://example.com/foo', 'http://example.com/bar')\n+\n+ def test_should_strip_auth_https_upgrade(self):\n+ s = requests.Session()\n+ assert not s.should_strip_auth('http://example.com/foo', 'https://example.com/bar')\n+ assert not s.should_strip_auth('http://example.com:80/foo', 'https://example.com/bar')\n+ assert not s.should_strip_auth('http://example.com/foo', 'https://example.com:443/bar')\n+ # Non-standard ports should trigger stripping\n+ assert s.should_strip_auth('http://example.com:8080/foo', 'https://example.com/bar')\n+ assert s.should_strip_auth('http://example.com/foo', 'https://example.com:8443/bar')\n+\n+ def test_should_strip_auth_port_change(self):\n+ s = requests.Session()\n+ assert s.should_strip_auth('http://example.com:1234/foo', 'https://example.com:4321/bar')\n+\n def test_manual_redirect_with_partial_body_read(self, httpbin):\n s = requests.Session()\n r1 = s.get(httpbin('redirect/2'), allow_redirects=False, stream=True)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 132958228,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Hi [USER_REDACTED], thanks for contributing to Requests! I agree that this behavior does seem wrong and we ideally shouldn’t be sending credentials across the wire in clear view. I took a quick look but was surprisingly unable to find this discussed before. While I’m inclined to merge this, there’s likely some concern about breaking users relying on us not doing the right thing here. I’d like [USER_REDACTED] to weigh in with his thoughts before we move forward.\n\nIn the meantime, I’ve left a couple minor notes on some of the changes.",
+ "submitted_at": "2018-06-28T18:09:25+00:00"
+ },
+ {
+ "id": 132962603,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-28T18:20:04+00:00"
+ },
+ {
+ "id": 132962746,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-28T18:20:29+00:00"
+ },
+ {
+ "id": 133309157,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-29T17:17:46+00:00"
+ },
+ {
+ "id": 133309445,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-29T17:18:40+00:00"
+ },
+ {
+ "id": 133321938,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-29T17:56:36+00:00"
+ },
+ {
+ "id": 133714429,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-02T17:32:30+00:00"
+ },
+ {
+ "id": 133724794,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-02T18:05:53+00:00"
+ },
+ {
+ "id": 133891499,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-03T08:17:26+00:00"
+ },
+ {
+ "id": 145456031,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-11T20:08:26+00:00"
+ },
+ {
+ "id": 145549612,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T08:06:28+00:00"
+ },
+ {
+ "id": 145655521,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T13:37:14+00:00"
+ },
+ {
+ "id": 145662416,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T13:52:38+00:00"
+ },
+ {
+ "id": 145672168,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T14:13:54+00:00"
+ },
+ {
+ "id": 145716413,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T15:47:14+00:00"
+ },
+ {
+ "id": 145722861,
+ "user": "user_b08fb5f52ea1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T16:01:37+00:00"
+ },
+ {
+ "id": 145725559,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-13T16:07:36+00:00"
+ },
+ {
+ "id": 146021745,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-14T11:32:58+00:00"
+ },
+ {
+ "id": 148875561,
+ "user": "user_44c1846fca70",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-08-23T11:58:23+00:00"
+ },
+ {
+ "id": 152489974,
+ "user": "user_b08fb5f52ea1",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-09-05T13:20:04+00:00"
+ },
+ {
+ "id": 152555114,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": "Ok, I think this is set to go. Thanks for driving this, [USER_REDACTED]!",
+ "submitted_at": "2018-09-05T15:28:14+00:00"
+ },
+ {
+ "id": 152578619,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-09-05T16:19:16+00:00"
+ },
+ {
+ "id": 155466028,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Ok, this still looks good. Thanks again for driving this [USER_REDACTED]!",
+ "submitted_at": "2018-09-14T12:07:27+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 198934960,
+ "user": "user_dbf2a999bd6d",
+ "body": "We may want to do the explicit check on scheme, hostname, and port here. Otherwise a url with credentials that’s redirected without credentials may have the Authorization header unnecessarily stripped.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-28T18:08:00+00:00"
+ },
+ {
+ "id": 198935315,
+ "user": "user_dbf2a999bd6d",
+ "body": "We should be explicit here and validate that `Authorization` is not in the request headers rather than checking if the value is falsey.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-28T18:09:13+00:00"
+ },
+ {
+ "id": 198938488,
+ "user": "user_44c1846fca70",
+ "body": "Fair enough, I hadn't spotted that the username and password are still present in response.request.url.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-28T18:20:04+00:00"
+ },
+ {
+ "id": 198938605,
+ "user": "user_44c1846fca70",
+ "body": "I was just copying the test above it, but I agree that would be an improvement. Will fix it tomorrow.",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-28T18:20:29+00:00"
+ },
+ {
+ "id": 199226219,
+ "user": "user_0fa58b6f3572",
+ "body": "`r.json()['headers']` should also be a way to verify that it wasn't *sent*",
+ "path": "tests/test_requests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-29T17:17:46+00:00"
+ },
+ {
+ "id": 199226444,
+ "user": "user_0fa58b6f3572",
+ "body": "I think this might need to be a bit different. I think if someone sent credentials over `HTTP` and we're being redirected to the same domain but it's `HTTPS` we should allow that. That's a secure upgrade. The opposite should not be allowed.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-29T17:18:39+00:00"
+ },
+ {
+ "id": 199236189,
+ "user": "user_44c1846fca70",
+ "body": "I did it this way based on RFC 7235:\n\n> A protection space is defined by [NAME_REDACTED] (the scheme\n and authority components of the effective request URI; see Section\n 5.5 of [RFC7230]) of the server being accessed, in combination with\n the realm value if present.\n\n...\n\n> The protection space determines the domain over which credentials can\n be automatically applied. If a prior request has been authorized,\n the user agent MAY reuse the same credentials for all other requests\n within that protection space for a period of time determined by [NAME_REDACTED], parameters, and/or user preferences (such as a\n configurable inactivity timeout).\n\nWhile it's not explicit, the implication is that a user agent may not automatically reuse the credentials outside the protection space, and a change from http -> https is a change in protection space.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-29T17:56:36+00:00"
+ },
+ {
+ "id": 199569417,
+ "user": "user_dbf2a999bd6d",
+ "body": "[USER_REDACTED], just to be clear, the spec you’re referencing is specifically about the realm attribute, which is different that what we’re doing here.\n\nIf we look at browsers for reference here, upgrade redirects maintain Authorization headers. Breaking this will make a common pattern pretty painful for most users.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-02T17:32:30+00:00"
+ },
+ {
+ "id": 199577864,
+ "user": "user_44c1846fca70",
+ "body": "Strange, I thought I'd tested the http -> https case with Firefox and Chromium and neither had sent the Authorization header. I'll take a closer look at my test when I'm in the office tomorrow.\n\nJust to check that I'm testing the same thing that you're referring to: my test is a localhost Apache server listening on http and https. On http it is set up to require basic auth, and on some path it is set up to send a 302 redirect to somewhere on https. I point the browser at the http port, I get a WWW-Authenticate challenge and I type in username+password, I then get redirected to https and the browser either does or doesn't automatically send the same credentials immediately without another WWW-Authenticate challenge?",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-02T18:05:53+00:00"
+ },
+ {
+ "id": 199720262,
+ "user": "user_44c1846fca70",
+ "body": "I've redone my test, using `openssl s_server` to see the request headers that the browser sends to the https port after the redirect. Firefox definitely isn't preserving the Authorization header across the redirect. Let me know if you'd like more details to reproduce the test (httpd.conf etc) using Docker.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-03T08:17:26+00:00"
+ },
+ {
+ "id": 209436425,
+ "user": "user_dbf2a999bd6d",
+ "body": "Hi [USER_REDACTED], it looks like Firefox does adhere to this rule. I'm a bit worried that adding the stripping from HTTP->HTTPS is going to be breaking for some people. I think for this patch, we should focus on removing the immediate security risk, and then we can add a todo for Requests3 to make this more in line with how browsers are behaving.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-11T20:08:26+00:00"
+ },
+ {
+ "id": 209521493,
+ "user": "user_44c1846fca70",
+ "body": "Thanks for reminding me about this PR. Okay, I can add an exception to allow http -> https redirects, with a comment to explain why.\n\nHow do you want to handle port changes? For example, `http://example.com` -> `https://example.com` is one thing (which implicitly changes the port from 80 to 443), but what about `http://example.com:8080` -> `https://example.com:12345` or `http://example.com` -> `http://example.com:12345`? That last one seems like a security risk since a non-root user could listen on an arbitrary port.\n\nI bring up the port changes because the unit test necessarily runs httpbin on non-standard ports and so there is no way to test redirects with implicit port numbers.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T08:06:28+00:00"
+ },
+ {
+ "id": 209611050,
+ "user": "user_b08fb5f52ea1",
+ "body": "Any change in a URLs origin should probably result in stripping of security headers. Origin for `http/https` URLs is scheme, hostname, and port. The only cases we should keep headers on a cross-origin redirect IMO are `http://example.com:80 -> https://example.com:443` and `http://example.com:1234 -> https://example.com:1234`. Thoughts?",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T13:37:14+00:00"
+ },
+ {
+ "id": 209616586,
+ "user": "user_44c1846fca70",
+ "body": "I think that matches the logic I started implementing (with the exception that it will only allow upgrade from 80->443 when both are implicit):\n```python\nhttps_upgrade = original_parsed.scheme == 'http' and redirect_parsed.scheme == 'https'\nif (original_parsed.hostname != redirect_parsed.hostname\n or original_parsed.port != redirect_parsed.port\n or (original_parsed.scheme != redirect_parsed.scheme and not https_upgrade)):\n```\nDoes that look reasonable?\n\nThe catch is that it's not really possible to test with httpbin, because we don't get to pick the port numbers that httpbin runs on. One option would be to move this logic into its own function (that just takes two URLs and decides whether to strip) and unit test that function separately from the end-to-end test through httpbin. The existing end-to-end tests should be sufficient to check that the actual stripping is done correctly.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T13:52:38+00:00"
+ },
+ {
+ "id": 209624235,
+ "user": "user_b08fb5f52ea1",
+ "body": "Question because I don't know the behavior of the URL parser, if you parse `http://example.com` and `http://example.com:80` do you get a different value of `redirect_parsed.port`, is it `None` on implicit?",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T14:13:53+00:00"
+ },
+ {
+ "id": 209660749,
+ "user": "user_44c1846fca70",
+ "body": "Yes\n```python\n>>> print(urllib.parse.urlparse('http://example.com/').port)\nNone\n>>> print(urllib.parse.urlparse('http://example.com:80/').port)\n80\n```",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T15:47:14+00:00"
+ },
+ {
+ "id": 209665887,
+ "user": "user_b08fb5f52ea1",
+ "body": "So we'd have to account for that in our comparison above as we want `http://example.com:80` -> `https://example.com` to work the same as `http://example.com` -> `https://example.com`.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T16:01:37+00:00"
+ },
+ {
+ "id": 209668067,
+ "user": "user_dbf2a999bd6d",
+ "body": "At this point there’s enough complexity in this implementation we should probably move it into it’s own check function.\n\nI think Seth’s assessment is right here. We want to check the following:\n\n1. The hostnames match.\n2. The schemes match...\n * Except in the case of http->https\n * If scheme change is http->https, origin port may be 80 or None and destination port may be 443 or None.\n3. Ports match, except in above scenario.\n4. Same scheme and hostname but varied port results in stripped auth.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-13T16:07:36+00:00"
+ },
+ {
+ "id": 209917194,
+ "user": "user_44c1846fca70",
+ "body": "Sounds sensible to me. I've implemented that in the latest push.\n\nI've left the logic in a public method of SessionRedirectMixin, because that gives the user the option to override it in a subclass, but let me know if I should move it to utils.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-14T11:32:58+00:00"
+ },
+ {
+ "id": 212280641,
+ "user": "user_44c1846fca70",
+ "body": "Ping? I think I've addressed the comments so far.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-08-23T11:58:23+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 18,
+ "DISMISSED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 20,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 20
+ }
+}
+{
+ "_id": "193bcf7452369471",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.504585+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4717,
+ "title": "Add official Python 3.7 support",
+ "body": "Python 3.7 was just released [1]. This is a small change to\nenable support in requests.\n\n[1] https://docs.python.org/3.7/whatsnew/3.7.html\n\nSigned-off-by: [NAME_EMAIL_REDACTED]",
+ "author": "user_ce33bf3d5b61",
+ "created_at": "2018-06-28T06:32:11+00:00",
+ "merged_at": "2018-07-24T14:44:38+00:00",
+ "base_branch": "master",
+ "head_branch": "py37",
+ "additions": 30,
+ "deletions": 11,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": ".travis.yml",
+ "status": "modified",
+ "additions": 24,
+ "deletions": 11,
+ "changes": 35,
+ "patch": "@@ -1,14 +1,5 @@\n sudo: false\n language: python\n-python:\n- # - \"2.6\"\n- - \"2.7\"\n- - \"3.4\"\n- - \"3.5\"\n- - \"3.6\"\n- - \"3.7-dev\"\n- # - \"pypy\" -- appears to hang\n- # - \"pypy3\"\n # command to install dependencies\n install: \"make\"\n # command to run tests\n@@ -21,9 +12,31 @@ jobs:\n include:\n - stage: test\n script:\n- - |\n- if [[ \"$TRAVIS_PYTHON_VERSION\" != \"2.6\" ]] ; then make test-readme; fi\n+ - make test-readme\n - make ci\n+ python: '2.7'\n+ - stage: test\n+ script:\n+ - make test-readme\n+ - make ci\n+ python: '3.4'\n+ - stage: test\n+ script:\n+ - make test-readme\n+ - make ci\n+ python: '3.5'\n+ - stage: test\n+ script:\n+ - make test-readme\n+ - make ci\n+ python: '3.6'\n+ - stage: test\n+ script:\n+ - make test-readme\n+ - make ci\n+ python: '3.7'\n+ dist: xenial\n+ sudo: true \n - stage: coverage\n python: 3.6\n script: codecov"
+ },
+ {
+ "filename": "appveyor.yml",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 0,
+ "changes": 5,
+ "patch": "@@ -25,6 +25,11 @@ environment:\n PYTHON_ARCH: \"64\"\n TOXENV: \"py36\"\n \n+ - PYTHON: \"C:\\\\Python37-x64\"\n+ PYTHON_VERSION: \"3.7.x\"\n+ PYTHON_ARCH: \"64\"\n+ TOXENV: \"py37\"\n+\n install:\n # [NAME_REDACTED] (from the official .msi of http://python.org) and pip when\n # not already installed."
+ },
+ {
+ "filename": "setup.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -95,6 +95,7 @@ def run_tests(self):\n '[NAME_REDACTED] :: Python :: 3.4',\n '[NAME_REDACTED] :: Python :: 3.5',\n '[NAME_REDACTED] :: Python :: 3.6',\n+ '[NAME_REDACTED] :: Python :: 3.7',\n '[NAME_REDACTED] :: Python :: Implementation :: CPython',\n '[NAME_REDACTED] :: Python :: Implementation :: PyPy'\n ),"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 139138443,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-07-20T17:07:50+00:00"
+ },
+ {
+ "id": 139142511,
+ "user": "user_278727a2e287",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-20T17:22:09+00:00"
+ },
+ {
+ "id": 139143575,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-20T17:25:31+00:00"
+ },
+ {
+ "id": 139495497,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-23T14:21:17+00:00"
+ },
+ {
+ "id": 139495868,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-07-23T14:22:02+00:00"
+ },
+ {
+ "id": 139926086,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Alright, I think this looks good to go. Thanks for seeing this all the way through, [USER_REDACTED]!",
+ "submitted_at": "2018-07-24T14:44:05+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 204113227,
+ "user": "user_278727a2e287",
+ "body": "This could drop the `|` and fit on one line",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:20:25+00:00"
+ },
+ {
+ "id": 204113248,
+ "user": "user_278727a2e287",
+ "body": "Same.",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:20:30+00:00"
+ },
+ {
+ "id": 204113487,
+ "user": "user_278727a2e287",
+ "body": "Same.",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:21:24+00:00"
+ },
+ {
+ "id": 204113526,
+ "user": "user_278727a2e287",
+ "body": "Same.",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:21:30+00:00"
+ },
+ {
+ "id": 204113619,
+ "user": "user_278727a2e287",
+ "body": "Same.",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:21:45+00:00"
+ },
+ {
+ "id": 204114188,
+ "user": "user_dbf2a999bd6d",
+ "body": "Why do we need sudo here and does this conflict with the sudo: False declaration above?",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-20T17:23:55+00:00"
+ },
+ {
+ "id": 204114432,
+ "user": "user_dbf2a999bd6d",
+ "body": "Could we get a quick explanation of the benefits/trade offs of moving from the matrix approach to this new setup?",
+ "path": ".travis.yml",
+ "line": 3,
+ "side": "LEFT",
+ "created_at": "2018-07-20T17:24:49+00:00"
+ },
+ {
+ "id": 204419234,
+ "user": "user_0fa58b6f3572",
+ "body": "No, it does not. This is the only way to use xenial on Travis is to use sudo on this job alone. And xenial is the only target that has true Python 3.7. So it's not ideal (because enabling sudo is *slow*) but it's the best we have right now",
+ "path": ".travis.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-07-23T14:21:17+00:00"
+ },
+ {
+ "id": 204419562,
+ "user": "user_0fa58b6f3572",
+ "body": "You mean moving from the old configuration to the more explicit matrix definition? Other than greater flexibility?",
+ "path": ".travis.yml",
+ "line": 3,
+ "side": "LEFT",
+ "created_at": "2018-07-23T14:22:02+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "DISMISSED": 1,
+ "COMMENTED": 4,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 9
+ }
+}
+{
+ "_id": "c83dd4e2b987bd5f",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.512748+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4701,
+ "title": "Documentation and tests for form-encoded multivalued elements as lists",
+ "body": null,
+ "author": "user_ce471cb70cc6",
+ "created_at": "2018-06-20T19:26:18+00:00",
+ "merged_at": "2018-07-20T16:56:28+00:00",
+ "base_branch": "master",
+ "head_branch": "4700-multivalued-list-form-encoded",
+ "additions": 19,
+ "deletions": 6,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "AUTHORS.rst",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -188,3 +188,4 @@ Patches and Suggestions\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n - [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])\n+- [NAME_REDACTED] ([CONTRIBUTOR_REDACTED])"
+ },
+ {
+ "filename": "docs/user/quickstart.rst",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 6,
+ "changes": 18,
+ "patch": "@@ -244,12 +244,16 @@ dictionary of data will automatically be form-encoded when the request is made::\n ...\n }\n \n-You can also pass a list of tuples to the ``data`` argument. This is particularly\n-useful when the form has multiple elements that use the same key::\n-\n- >>> payload = (('key1', 'value1'), ('key1', 'value2'))\n- >>> r = requests.post('http://httpbin.org/post', data=payload)\n- >>> print(r.text)\n+The ``data`` argument can also have multiple values for each key. This can be\n+done by making ``data`` either a list of tuples or a dictionary with lists\n+as values. This is particularly useful when the form has multiple elements that\n+use the same key::\n+\n+ >>> payload_tuples = [('key1', 'value1'), ('key1', 'value2')]\n+ >>> r1 = requests.post('http://httpbin.org/post', data=payload_tuples)\n+ >>> payload_dict = {'key1': ['value1', 'value2']}\n+ >>> r2 = requests.post('http://httpbin.org/post', data=payload_dict)\n+ >>> print(r1.text)\n {\n ...\n \"form\": {\n@@ -260,6 +264,8 @@ useful when the form has multiple elements that use the same key::\n },\n ...\n }\n+ >>> r1.text == r2.text\n+ True\n \n There are times that you may want to send data that is not form-encoded. If\n you pass in a ``string`` instead of a ``dict``, that data will be posted directly."
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -868,6 +868,12 @@ def test_urlencoded_get_query_multivalued_param(self, httpbin):\n assert r.status_code == 200\n assert r.url == httpbin('get?test=foo&test=baz')\n \n+ def test_form_encoded_post_query_multivalued_element(self, httpbin):\n+ r = requests.Request(method='POST', url=httpbin('post'),\n+ data=dict(test=['foo', 'baz']))\n+ prep = r.prepare()\n+ assert prep.body == 'test=foo&test=baz'\n+\n def test_different_encodings_dont_break_post(self, httpbin):\n r = requests.post(httpbin('post'),\n data={'stuff': json.dumps({'a': 123})},"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 130651646,
+ "user": "user_dbf2a999bd6d",
+ "state": "CHANGES_REQUESTED",
+ "body": "Hi [USER_REDACTED], thanks for contributing to Requests! I actually didn't know this would work, so thanks for teaching me something new.\n\nI left a quick comment about consolidating this with the current tuple example. Let me know what you think about that and we can work forward from there.",
+ "submitted_at": "2018-06-21T02:51:04+00:00"
+ },
+ {
+ "id": 133326989,
+ "user": "user_ce471cb70cc6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-06-29T18:11:33+00:00"
+ },
+ {
+ "id": 134459823,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-07-04T19:29:04+00:00"
+ },
+ {
+ "id": 139134767,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "I think this looks good, thanks [USER_REDACTED]!",
+ "submitted_at": "2018-07-20T16:56:17+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 196997499,
+ "user": "user_dbf2a999bd6d",
+ "body": "It may be better to roll this into the example above. They are both performing the same action, just with different syntactic sugar.",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-21T02:49:52+00:00"
+ },
+ {
+ "id": 199240167,
+ "user": "user_ce471cb70cc6",
+ "body": "I rolled the examples into one in c61f36e. Does that look like what you were thinking about?",
+ "path": "docs/user/quickstart.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-06-29T18:11:33+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "rst"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 1,
+ "DISMISSED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "e2105328d38b3cbd",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.513781+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4501,
+ "title": "Separate collections from collections.abc",
+ "body": "In Python 3.7, there is a warning that the abstract bases in collections.abc will no longer be accessible through the regular collections module in Python 3.8. This patch future-proofs requests.\n\nI wasn't able to run the test suite locally, so this needs a thorough test going forward.",
+ "author": "user_3f2a938a80b3",
+ "created_at": "2018-02-05T04:19:41+00:00",
+ "merged_at": "2018-06-12T05:15:01+00:00",
+ "base_branch": "master",
+ "head_branch": "master",
+ "additions": 17,
+ "deletions": 19,
+ "changed_files": 7,
+ "files": [
+ {
+ "filename": "requests/compat.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 0,
+ "changes": 2,
+ "patch": "@@ -43,6 +43,7 @@\n import cookielib\n from Cookie import Morsel\n from StringIO import StringIO\n+ from collections import Callable, Mapping, MutableMapping\n \n from urllib3.packages.ordered_dict import OrderedDict\n \n@@ -60,6 +61,7 @@\n from http.cookies import Morsel\n from io import StringIO\n from collections import OrderedDict\n+ from collections.abc import Callable, Mapping, MutableMapping\n \n builtin_str = str\n str = str"
+ },
+ {
+ "filename": "requests/cookies.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 3,
+ "changes": 5,
+ "patch": "@@ -12,10 +12,9 @@\n import copy\n import time\n import calendar\n-import collections\n \n from ._internal_utils import to_native_string\n-from .compat import cookielib, urlparse, urlunparse, Morsel\n+from .compat import cookielib, urlparse, urlunparse, Morsel, MutableMapping\n \n try:\n import threading\n@@ -169,7 +168,7 @@ class CookieConflictError(RuntimeError):\n \"\"\"\n \n \n-class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):\n+class RequestsCookieJar(cookielib.CookieJar, MutableMapping):\n \"\"\"Compatibility class; is a cookielib.CookieJar, but exposes a dict\n interface."
+ },
+ {
+ "filename": "requests/models.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 4,
+ "changes": 8,
+ "patch": "@@ -7,7 +7,6 @@\n This module contains the primary objects that power Requests.\n \"\"\"\n \n-import collections\n import datetime\n import sys\n \n@@ -37,6 +36,7 @@\n stream_decode_response_unicode, to_key_val_list, parse_header_links,\n iter_slices, guess_json_utf, super_len, check_header_validity)\n from .compat import (\n+ Callable, Mapping,\n cookielib, urlunparse, urlsplit, urlencode, str, bytes,\n is_py2, chardet, builtin_str, basestring)\n from .compat import json as complexjson\n@@ -174,10 +174,10 @@ def register_hook(self, event, hook):\n if event not in self.hooks:\n raise ValueError('Unsupported event specified, with event name \"%s\"' % (event))\n \n- if isinstance(hook, collections.Callable):\n+ if isinstance(hook, Callable):\n self.hooks[event].append(hook)\n elif hasattr(hook, '__iter__'):\n- self.hooks[event].extend(h for h in hook if isinstance(h, collections.Callable))\n+ self.hooks[event].extend(h for h in hook if isinstance(h, Callable))\n \n def deregister_hook(self, event, hook):\n \"\"\"Deregister a previously registered hook.\n@@ -461,7 +461,7 @@ def prepare_body(self, data, files, json=None):\n \n is_stream = all([\n hasattr(data, '__iter__'),\n- not isinstance(data, (basestring, list, tuple, collections.Mapping))\n+ not isinstance(data, (basestring, list, tuple, Mapping))\n ])\n \n try:"
+ },
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 2,
+ "changes": 3,
+ "patch": "@@ -10,11 +10,10 @@\n import os\n import sys\n import time\n-from collections import Mapping\n from datetime import timedelta\n \n from .auth import _basic_auth_str\n-from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse\n+from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse, Mapping\n from .cookies import (\n cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_cookies)\n from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT"
+ },
+ {
+ "filename": "requests/structures.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 6,
+ "changes": 10,
+ "patch": "@@ -7,16 +7,14 @@\n Data structures that power Requests.\n \"\"\"\n \n-import collections\n+from .compat import OrderedDict, Mapping, MutableMapping\n \n-from .compat import OrderedDict\n \n-\n-class CaseInsensitiveDict(collections.MutableMapping):\n+class CaseInsensitiveDict(MutableMapping):\n \"\"\"A case-insensitive ``dict``-like object.\n \n Implements all methods and operations of\n- ``collections.MutableMapping`` as well as dict's ``copy``. Also\n+ ``MutableMapping`` as well as dict's ``copy``. Also\n provides ``lower_items``.\n \n All keys are expected to be strings. The structure remembers the\n@@ -71,7 +69,7 @@ def lower_items(self):\n )\n \n def __eq__(self, other):\n- if isinstance(other, collections.Mapping):\n+ if isinstance(other, Mapping):\n other = CaseInsensitiveDict(other)\n else:\n return NotImplemented"
+ },
+ {
+ "filename": "requests/utils.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 3,
+ "changes": 5,
+ "patch": "@@ -9,7 +9,6 @@\n \"\"\"\n \n import codecs\n-import collections\n import contextlib\n import io\n import os\n@@ -29,7 +28,7 @@\n from .compat import (\n quote, urlparse, bytes, str, OrderedDict, unquote, getproxies,\n proxy_bypass, urlunparse, basestring, integer_types, is_py3,\n- proxy_bypass_environment, getproxies_environment)\n+ proxy_bypass_environment, getproxies_environment, Mapping)\n from .cookies import cookiejar_from_dict\n from .structures import CaseInsensitiveDict\n from .exceptions import (\n@@ -301,7 +300,7 @@ def to_key_val_list(value):\n if isinstance(value, (str, bytes, bool, int)):\n raise ValueError('cannot encode objects that are not 2-tuples')\n \n- if isinstance(value, collections.Mapping):\n+ if isinstance(value, Mapping):\n value = value.items()\n \n return list(value)"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -29,6 +29,7 @@\n from requests.sessions import SessionRedirectMixin\n from requests.models import urlencode\n from requests.hooks import default_hooks\n+from requests.compat import MutableMapping\n \n from .compat import StringIO, u\n from .utils import override_environ\n@@ -726,7 +727,7 @@ def test_POSTBIN_GET_POST_FILES_WITH_DATA(self, httpbin):\n requests.post(url, files=['bad file data'])\n \n def test_post_with_custom_mapping(self, httpbin):\n- class CustomMapping(collections.MutableMapping):\n+ class CustomMapping(MutableMapping):\n def __init__(self, *args, **kwargs):\n self.data = dict(*args, **kwargs)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 93899681,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Hi [USER_REDACTED], thanks for contributing to Requests! This looks like it will resolve #4494 by [NAME_REDACTED] for Python 3.7. I'd like another maintainer to approve this PR before merging, but I believe this looks good from my end.",
+ "submitted_at": "2018-02-05T07:19:13+00:00"
+ },
+ {
+ "id": 94698322,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": null,
+ "submitted_at": "2018-02-07T13:01:19+00:00"
+ },
+ {
+ "id": 94748211,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-02-07T15:24:32+00:00"
+ },
+ {
+ "id": 95700740,
+ "user": "user_3f2a938a80b3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-02-12T07:06:03+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 166609518,
+ "user": "user_0fa58b6f3572",
+ "body": "[USER_REDACTED] on which versions of Python 3 will this actually succeed on? It was my impression that `collections.abc` was introduced in 3.6 or 3.7.",
+ "path": "requests/compat.py",
+ "line": 64,
+ "side": "RIGHT",
+ "created_at": "2018-02-07T13:00:58+00:00"
+ },
+ {
+ "id": 166651224,
+ "user": "user_dbf2a999bd6d",
+ "body": "[USER_REDACTED] I'd tested it back to 3.4 without issue, so I think this should work.",
+ "path": "requests/compat.py",
+ "line": 64,
+ "side": "RIGHT",
+ "created_at": "2018-02-07T15:24:32+00:00"
+ },
+ {
+ "id": 167477993,
+ "user": "user_3f2a938a80b3",
+ "body": "This works back to Python 3.3.",
+ "path": "requests/compat.py",
+ "line": 64,
+ "side": "RIGHT",
+ "created_at": "2018-02-12T07:06:03+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "DISMISSED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "386f736ba9ffc5a0",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.514783+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4497,
+ "title": "Clarify docs that Requests always uses certs from certifi",
+ "body": "Since commit 0d7de6430eef0cf09f9662746daf0c28d83f144e, certifi is always used for certificates. Certify became a hard dependency of the package in 628633143d5b8590b1dbdf5371fe81fb8250dffd.\n\nNow update the docs to clarify that Request will always use certificates from certifi.",
+ "author": "user_278727a2e287",
+ "created_at": "2018-02-03T00:01:39+00:00",
+ "merged_at": "2018-02-16T01:56:01+00:00",
+ "base_branch": "master",
+ "head_branch": "docs-certfi",
+ "additions": 8,
+ "deletions": 9,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "docs/user/advanced.rst",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 9,
+ "changes": 17,
+ "patch": "@@ -274,15 +274,14 @@ If you specify a wrong path or an invalid cert, you'll get a SSLError::\n CA Certificates\n ---------------\n \n-By default, Requests bundles a set of root CAs that it trusts, sourced from the\n-`Mozilla trust store`_. However, these are only updated once for each Requests\n-version. This means that if you pin a Requests version your certificates can\n-become extremely out of date.\n-\n-[NAME_REDACTED] version 2.4.0 onwards, Requests will attempt to use certificates\n-from `certifi`_ if it is present on the system. This allows for users to update\n-their trusted certificates without having to change the code that runs on their\n-system.\n+Requests uses certificates from the package `certifi`_. This allows for users\n+to update their trusted certificates without changing the version of Requests.\n+\n+Before version 2.16, Requests bundled a set of root CAs that it trusted,\n+sourced from the `Mozilla trust store`_. The certificates were only updated\n+once for each Requests version. When ``certifi`` was not installed, this led to\n+extremely out-of-date certificate bundles when using significantly older\n+versions of Requests.\n \n For the sake of security we recommend upgrading certifi frequently!"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 93898195,
+ "user": "user_dbf2a999bd6d",
+ "state": "DISMISSED",
+ "body": "If you feel like it, we could probably remove \"Starting with version 2.4.0, certifi became an optional dependency and Requests would attempt to use its certificates if it was present. Since version 2.16, certifi is a mandatory dependency.\" but I think this looks good. Thanks [USER_REDACTED]!",
+ "submitted_at": "2018-02-05T07:08:21+00:00"
+ },
+ {
+ "id": 94695306,
+ "user": "user_0fa58b6f3572",
+ "state": "CHANGES_REQUESTED",
+ "body": null,
+ "submitted_at": "2018-02-07T12:49:53+00:00"
+ },
+ {
+ "id": 94738841,
+ "user": "user_278727a2e287",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-02-07T15:01:15+00:00"
+ },
+ {
+ "id": 96485450,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-02-14T12:52:42+00:00"
+ },
+ {
+ "id": 96501367,
+ "user": "user_278727a2e287",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-02-14T13:48:32+00:00"
+ },
+ {
+ "id": 96995293,
+ "user": "user_0fa58b6f3572",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2018-02-15T20:30:51+00:00"
+ },
+ {
+ "id": 97067255,
+ "user": "user_dbf2a999bd6d",
+ "state": "APPROVED",
+ "body": "Alright, I think this looks good. Thanks [USER_REDACTED]!",
+ "submitted_at": "2018-02-16T01:55:53+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 166607012,
+ "user": "user_0fa58b6f3572",
+ "body": "They would be out of date if and only if users didn't separately install certifi. This is a blanket statement that is plainly untrue.",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-02-07T12:49:48+00:00"
+ },
+ {
+ "id": 166643502,
+ "user": "user_278727a2e287",
+ "body": "This is why I included \"could\". It is true under some conditions, but not others.\n\nHow would you like to see it altered?\n\nWhat about?\n\n> This meant that the certificates of a pinned version of Requests could become extremely out of date if certi was not installed.\n\nOr should the sentence be removed entirely? Any other suggestions?",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-02-07T15:01:15+00:00"
+ },
+ {
+ "id": 168164414,
+ "user": "user_0fa58b6f3572",
+ "body": "I think the `could` is too subtle. What about:\n\n```\nWhen `certifi` was not installed, this led to extremely out-of-date certificate bundles when using significantly older versions of Requests.\n```",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-02-14T12:52:42+00:00"
+ },
+ {
+ "id": 168178111,
+ "user": "user_278727a2e287",
+ "body": "Sounds good and works for me. I've changed the wording as suggested in the latest revision of the PR.",
+ "path": "docs/user/advanced.rst",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-02-14T13:48:32+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "rst"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "DISMISSED": 1,
+ "CHANGES_REQUESTED": 1,
+ "COMMENTED": 3,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": true,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "8510490e1871b843",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.516778+00:00",
+ "repo": "psf/requests",
+ "repo_url": "https://github.com/psf/requests",
+ "license_name": "Apache License 2.0",
+ "license_spdx": "Apache-2.0",
+ "pr_number": 4452,
+ "title": "append previous url fragment on redirect",
+ "body": "This PR should address #4443 by [NAME_REDACTED] fragment to subsequent redirects, unless a new fragment is provided in the Location header. This behaviour should bring us into compliance with [RFC 7230 § 7.1.2](https://tools.ietf.org/html/rfc7231#section-7.1.2). I also wrote a test to confirm we don't send fragment information to new servers, our underlying implementation strips that.\n\nOne outstanding question I do have though is about chained redirects. \n\n-----\n\nLet's say we make a request (`http://url#alice`) and get a 302 response (`http://new_url#bob`). We would leave `#bob` as the fragment for the second request. When we request `http://new_url#bob`, we get back another 301 to `http://final_url/`. Do we append `alice` or `bob` at this point? \n\nI went with the assumption that the \"original\" request is the first one in the chain. I could see an argument that all requests are stateless though, and that the `new_url#bob` is the only originating request in scope for the second redirect.",
+ "author": "user_dbf2a999bd6d",
+ "created_at": "2018-01-07T21:28:31+00:00",
+ "merged_at": "2018-01-21T18:41:47+00:00",
+ "base_branch": "master",
+ "head_branch": "append_fragment_on_redirect",
+ "additions": 86,
+ "deletions": 1,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "requests/sessions.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 1,
+ "changes": 7,
+ "patch": "@@ -123,6 +123,7 @@ def resolve_redirects(self, resp, req, stream=False, timeout=None,\n hist = [] # keep track of history\n \n url = self.get_redirect_target(resp)\n+ previous_fragment = urlparse(req.url).fragment\n while url:\n prepared_request = req.copy()\n \n@@ -147,8 +148,12 @@ def resolve_redirects(self, resp, req, stream=False, timeout=None,\n parsed_rurl = urlparse(resp.url)\n url = '%s:%s' % (to_native_string(parsed_rurl.scheme), url)\n \n- # The scheme should be lower case...\n+ # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2)\n parsed = urlparse(url)\n+ if parsed.fragment == '' and previous_fragment:\n+ parsed = parsed._replace(fragment=previous_fragment)\n+ elif parsed.fragment:\n+ previous_fragment = parsed.fragment\n url = parsed.geturl()\n \n # Facilitate relative 'location' headers, as allowed by RFC 7231."
+ },
+ {
+ "filename": "tests/test_lowlevel.py",
+ "status": "modified",
+ "additions": 72,
+ "deletions": 0,
+ "changes": 72,
+ "patch": "@@ -235,3 +235,75 @@ def redirect_resp_handler(sock):\n assert r.url == u'{0}/{1}'.format(url, expected_path.decode('ascii'))\n \n close_server.set()\n+\n+def test_fragment_not_sent_with_request():\n+ \"\"\"Verify that the fragment portion of a URI isn't sent to the server.\"\"\"\n+ def response_handler(sock):\n+ req = consume_socket_content(sock, timeout=0.5)\n+ sock.send(\n+ b'HTTP/1.1 200 OK\\r\\n'\n+ b'Content-Length: '+bytes(len(req))+b'\\r\\n'\n+ b'\\r\\n'+req\n+ )\n+\n+ close_server = threading.Event()\n+ server = Server(response_handler, wait_to_close_event=close_server)\n+\n+ with server as (host, port):\n+ url = 'http://{0}:{1}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n+ r = requests.get(url)\n+ raw_request = r.content\n+\n+ assert r.status_code == 200\n+ headers, body = raw_request.split(b'\\r\\n\\r\\n', 1)\n+ status_line, headers = headers.split(b'\\r\\n', 1)\n+\n+ assert status_line == b'GET /path/to/thing/ HTTP/1.1'\n+ for frag in (b'view', b'edit', b'token', b'hunter2'):\n+ assert frag not in headers\n+ assert frag not in body\n+\n+ close_server.set()\n+\n+def test_fragment_update_on_redirect():\n+ \"\"\"Verify we only append previous fragment if one doesn't exist on new\n+ location. If a new fragment is encounterd in a Location header, it should\n+ be added to all subsequent requests.\n+ \"\"\"\n+\n+ def response_handler(sock):\n+ consume_socket_content(sock, timeout=0.5)\n+ sock.send(\n+ b'HTTP/1.1 302 FOUND\\r\\n'\n+ b'Content-Length: 0\\r\\n'\n+ b'Location: /get#relevant-section\\r\\n\\r\\n'\n+ )\n+ consume_socket_content(sock, timeout=0.5)\n+ sock.send(\n+ b'HTTP/1.1 302 FOUND\\r\\n'\n+ b'Content-Length: 0\\r\\n'\n+ b'Location: /final-url/\\r\\n\\r\\n'\n+ )\n+ consume_socket_content(sock, timeout=0.5)\n+ sock.send(\n+ b'HTTP/1.1 200 OK\\r\\n\\r\\n'\n+ )\n+\n+ close_server = threading.Event()\n+ server = Server(response_handler, wait_to_close_event=close_server)\n+\n+ with server as (host, port):\n+ url = 'http://{0}:{1}/path/to/thing/#view=edit&token=hunter2'.format(host, port)\n+ r = requests.get(url)\n+ raw_request = r.content\n+\n+ assert r.status_code == 200\n+ assert len(r.history) == 2\n+ assert r.history[0].request.url == url\n+\n+ # Verify we haven't overwritten the location with our previous fragment.\n+ assert r.history[1].request.url == 'http://{0}:{1}/get#relevant-section'.format(host, port)\n+ # Verify previous fragment is used and not the original.\n+ assert r.url == 'http://{0}:{1}/final-url/#relevant-section'.format(host, port)\n+\n+ close_server.set()"
+ },
+ {
+ "filename": "tests/test_requests.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -294,6 +294,14 @@ def test_transfer_enc_removal_on_redirect(self, httpbin):\n for header in purged_headers:\n assert header not in next_resp.request.headers\n \n+ def test_fragment_maintained_on_redirect(self, httpbin):\n+ fragment = \"#view=edit&token=hunter2\"\n+ r = requests.get(httpbin('redirect-to?url=get')+fragment)\n+\n+ assert len(r.history) > 0\n+ assert r.history[0].request.url == httpbin('redirect-to?url=get')+fragment\n+ assert r.url == httpbin('get')+fragment\n+\n def test_HTTP_200_OK_GET_WITH_PARAMS(self, httpbin):\n heads = {'User-agent': 'Mozilla/5.0'}"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 87116124,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-08T00:50:30+00:00"
+ },
+ {
+ "id": 87116502,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-08T01:03:32+00:00"
+ },
+ {
+ "id": 87116614,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-08T01:06:51+00:00"
+ },
+ {
+ "id": 87117419,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-08T01:31:51+00:00"
+ },
+ {
+ "id": 87512619,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-09T13:16:10+00:00"
+ },
+ {
+ "id": 87512795,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-09T13:16:56+00:00"
+ },
+ {
+ "id": 87931167,
+ "user": "user_dbf2a999bd6d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-10T18:18:01+00:00"
+ },
+ {
+ "id": 87963594,
+ "user": "user_0fa58b6f3572",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2018-01-10T20:03:55+00:00"
+ },
+ {
+ "id": 90332385,
+ "user": "user_0fa58b6f3572",
+ "state": "DISMISSED",
+ "body": "Once you rebase this, [USER_REDACTED] it should be good to merge. 🎉",
+ "submitted_at": "2018-01-21T13:40:25+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 160065925,
+ "user": "user_0fa58b6f3572",
+ "body": "I'm confused how this import is working right now. Maybe it's too late for me to be reviewing code?",
+ "path": "tests/testserver.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-08T00:50:30+00:00"
+ },
+ {
+ "id": 160066266,
+ "user": "user_dbf2a999bd6d",
+ "body": "😬 this is me running `git add tests` and not paying attention to garbage in the directory. Disregard this file.",
+ "path": "tests/testserver.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-08T01:03:32+00:00"
+ },
+ {
+ "id": 160066357,
+ "user": "user_0fa58b6f3572",
+ "body": "I await your force-push to remove it 😄",
+ "path": "tests/testserver.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-08T01:06:51+00:00"
+ },
+ {
+ "id": 160067034,
+ "user": "user_dbf2a999bd6d",
+ "body": "Ok, we should be updated now.",
+ "path": "tests/testserver.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-08T01:31:51+00:00"
+ },
+ {
+ "id": 160403161,
+ "user": "user_0fa58b6f3572",
+ "body": "Can we do `parsed._replace(fragment='previous_fragment')`?",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-09T13:16:10+00:00"
+ },
+ {
+ "id": 160403297,
+ "user": "user_0fa58b6f3572",
+ "body": "My concern is that `url` might end with `#` which should be equivalent to `parsed.fragment == ''`. What do we do there?",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-09T13:16:56+00:00"
+ },
+ {
+ "id": 160757996,
+ "user": "user_dbf2a999bd6d",
+ "body": "Yep, this is definitely a gap. It looks like `geturl()` will also strip empty fragments from redirect urls which probably isn’t the behavior we want.\n\nI’m a little leery of using private methods, but given that `_replace` has been stable for a decade it’s probably safe. I’m wondering given the trailing hash issue if it may be easier to append the fragment option (`’’`, `#`, `#fragment`) after we call `geturl`. I’ll try to come up with something tonight.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-10T18:18:01+00:00"
+ },
+ {
+ "id": 160785012,
+ "user": "user_0fa58b6f3572",
+ "body": "`_replace` is actually part of `namedtuple` which `ParseResult` inherits from. If we wanted to, we could switch wholesale to github.com/hyper/rfc3986 which has a proper public API for this but that is definitely more work than this.",
+ "path": "requests/sessions.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2018-01-10T20:03:55+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 8,
+ "DISMISSED": 1
+ },
+ "meaningful_comment_count": 8,
+ "has_approval": false,
+ "has_changes_requested": false,
+ "total_review_comments": 8
+ }
+}
+{
+ "_id": "78b7b1e6a342c82a",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.517779+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20657,
+ "title": "Refs #36644 -- Documented no pk ordering in first()/last() after empty order_by().",
+ "body": "#### Trac ticket number\nticket-36644\n\n#### Branch description\nAlthough I still think we can regard this as a bugfix, on second thought I think it deserves just a little documentation to clarify.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [ ] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_3a67c55598c5",
+ "created_at": "2026-02-09T20:17:12+00:00",
+ "merged_at": "2026-02-09T21:19:14+00:00",
+ "base_branch": "main",
+ "head_branch": "jtw/update-first-last-docs",
+ "additions": 13,
+ "deletions": 2,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/ref/models/querysets.txt",
+ "status": "modified",
+ "additions": 9,
+ "deletions": 2,
+ "changes": 11,
+ "patch": "@@ -2774,8 +2774,9 @@ the direction is changed.\n *Asynchronous version*: ``afirst()``\n \n Returns the first object matched by [NAME_REDACTED], or ``None`` if there\n-is no matching object. If the ``QuerySet`` has no ordering defined, then the\n-queryset is automatically ordered by [NAME_REDACTED] can affect\n+is no matching object. If the ``QuerySet`` has no ordering defined (and has not\n+had ordering forcibly cleared by calling :meth:`order_by` with no arguments),\n+then the queryset is automatically ordered by [NAME_REDACTED] can affect\n aggregation results as described in :ref:`aggregation-ordering-interaction`.\n \n Example::\n@@ -2790,6 +2791,12 @@ equivalent to the above example::\n except IndexError:\n p = None\n \n+.. versionchanged:: 6.1\n+\n+ ``first()`` and :meth:`last` no longer order by [NAME_REDACTED]\n+ ordering has been forcibly cleared by calling :meth:`order_by` with no\n+ arguments.\n+\n ``last()``\n ~~~~~~~~~~"
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -422,6 +422,10 @@ Miscellaneous\n ``null``, to match the behavior of :lookup:`exact=None ` on key\n transforms. Previously, it was interpreted as an :lookup:`isnull` lookup.\n \n+* :meth:`~.QuerySet.first` and :meth:`~.QuerySet.last` no longer order by the\n+ primary key when a ``QuerySet``'s ordering has been forcibly cleared by\n+ calling :meth:`~.QuerySet.order_by` with no arguments.\n+\n .. _deprecated-features-6.1:\n \n Features deprecated in 6.1"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3775136871,
+ "user": "user_057de2f3b132",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-02-09T20:25:05+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2784348743,
+ "user": "user_057de2f3b132",
+ "body": "This reads a bit better to me like this:\n\n```suggestion\nis no matching object. If the ``QuerySet`` has no ordering defined (and has not\nhad ordering forcibly cleared by calling :meth:`order_by` with no arguments),\n```",
+ "path": "docs/ref/models/querysets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T20:23:29+00:00"
+ },
+ {
+ "id": 2784352784,
+ "user": "user_057de2f3b132",
+ "body": "I think this reads a bit better like this:\n\n```suggestion\n ``first()`` and :meth:`last` no longer order by [NAME_REDACTED]\n ordering has been forcibly cleared by calling :meth:`order_by` with no\n arguments.\n```",
+ "path": "docs/ref/models/querysets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T20:24:22+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "c9b792d8b463f88c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.519778+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20656,
+ "title": "Clarified optional nature of [NAME_REDACTED].",
+ "body": "It's not clear that CLAs are needed to ensure contributors are assenting to our license (the \"inbound=outbound\" agreement), but we can keep them around for contributors who would like to (or are required by [NAME_REDACTED]) to submit one, without investing additional resources in checking every single contribution.\n\nSee https://forum.djangoproject.com/t/cla-vs-dco-for-django-contributors/42399 and recent board minutes.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### TODO\nUpdate flatpages on the website:\n- [x] https://www.djangoproject.com/foundation/cla/faq/\n- [x] https://www.djangoproject.com/foundation/cla/",
+ "author": "user_3a67c55598c5",
+ "created_at": "2026-02-09T15:31:52+00:00",
+ "merged_at": "2026-02-10T14:58:39+00:00",
+ "base_branch": "main",
+ "head_branch": "jtw/cla",
+ "additions": 8,
+ "deletions": 8,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "docs/internals/contributing/new-contributors.txt",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -69,8 +69,8 @@ Sign the [NAME_REDACTED]\n --------------------------------------\n \n The code that you write belongs to you or your employer. If your contribution\n-is more than one or two lines of code, you need to sign the `CLA`_. See the\n-`[NAME_REDACTED] FAQ`_ for a more thorough explanation.\n+is more than one or two lines of code, you have the option to sign the `CLA`_.\n+See the `[NAME_REDACTED] FAQ`_ for a more thorough explanation.\n \n .. _CLA: https://www.djangoproject.com/foundation/cla/\n .. _Contributor License Agreement FAQ: https://www.djangoproject.com/foundation/cla/faq/"
+ },
+ {
+ "filename": "docs/internals/contributing/writing-code/submitting-patches.txt",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 6,
+ "changes": 12,
+ "patch": "@@ -59,11 +59,10 @@ and time availability), claim it by [NAME_REDACTED]:\n * Finally click the \"Submit changes\" button at the bottom to save.\n \n .. note::\n- The Django software foundation requests that anyone contributing more than\n- a :ref:`trivial change `, to Django sign and submit a\n- `[NAME_REDACTED]`_, this ensures that the Django Software\n- Foundation has clear license to all contributions allowing for a clear\n- license for all users.\n+ If your change is not :ref:`trivial `, you have the option\n+ to sign and submit a `[NAME_REDACTED]`_ clarifying the status\n+ of your contribution. This ensures that the [NAME_REDACTED] has\n+ clear license to your contribution.\n \n .. _Login using your GitHub account: https://code.djangoproject.com/github/login\n .. _Create an account: https://www.djangoproject.com/accounts/register/\n@@ -508,7 +507,8 @@ All tickets\n * Is the pull request a single squashed commit with a message that follows our\n :ref:`commit message format `?\n * Are you the patch author and a new contributor? Please add yourself to the\n- :source:`AUTHORS` file and submit a `[NAME_REDACTED]`_.\n+ :source:`AUTHORS` file. At your option, submit a\n+ `[NAME_REDACTED]`_.\n * Does this have an accepted ticket on Trac? All contributions require a ticket\n unless the :ref:`change is considered trivial `."
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3774663809,
+ "user": "user_00dac951cdbf",
+ "state": "APPROVED",
+ "body": "LGTM overall! added some small suggestions. Thanks! 🌟",
+ "submitted_at": "2026-02-09T18:15:49+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2783929224,
+ "user": "user_00dac951cdbf",
+ "body": "Should we be more lenient and say:\n\n```suggestion\n If your change is not :ref:`trivial `, you have the option to\n```",
+ "path": "docs/internals/contributing/writing-code/submitting-patches.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T18:14:47+00:00"
+ },
+ {
+ "id": 2783932384,
+ "user": "user_00dac951cdbf",
+ "body": "Same here?",
+ "path": "docs/internals/contributing/new-contributors.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T18:15:31+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "43d1fad023feadab",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.522778+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20636,
+ "title": "Refs #33579 -- Added extra tests for NotUpdated exception.",
+ "body": "#### Trac ticket number\n\n\n\nticket-33579\n\n#### Branch description\nWhen `NotUpdated` was added in ab148c02cedbac492f29930dcd5346e1af052635, these additional tests that have equivalents for the `DoesNotExist` and `MultipleObjectsReturned` exceptions were missed.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [ ] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_194c2ef4033e",
+ "created_at": "2026-02-03T10:19:03+00:00",
+ "merged_at": "2026-02-05T14:18:55+00:00",
+ "base_branch": "main",
+ "head_branch": "ngnpope/ticket-33579",
+ "additions": 15,
+ "deletions": 3,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "tests/model_inheritance/tests.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -449,6 +449,12 @@ def test_inherited_multiple_objects_returned_exception(self):\n with self.assertRaises(Place.MultipleObjectsReturned):\n Restaurant.objects.get()\n \n+ def test_inherited_not_updated_exception(self):\n+ # NotUpdated is also inherited.\n+ obj = Restaurant(id=999)\n+ with self.assertRaises(Place.NotUpdated):\n+ obj.save(update_fields={\"name\"})\n+\n def test_related_objects_for_inherited_models(self):\n # Related objects work just as they normally do.\n s1 = Supplier.objects.create(name=\"[NAME_REDACTED]\", address=\"123 [NAME_REDACTED]\")"
+ },
+ {
+ "filename": "tests/proxy_models/tests.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 3,
+ "changes": 8,
+ "patch": "@@ -2,7 +2,7 @@\n from django.contrib.auth.models import User as AuthUser\n from django.contrib.contenttypes.models import ContentType\n from django.core import checks, management\n-from django.db import DEFAULT_DB_ALIAS, models\n+from django.db import DEFAULT_DB_ALIAS, models, transaction\n from django.db.models import signals\n from django.test import TestCase, override_settings\n from django.test.utils import isolate_apps\n@@ -104,8 +104,8 @@ def test_correct_type_proxy_of_proxy(self):\n \n def test_proxy_included_in_ancestors(self):\n \"\"\"\n- Proxy models are included in the ancestors for a model's DoesNotExist\n- and MultipleObjectsReturned\n+ Proxy models are included in the ancestors for a model's DoesNotExist,\n+ MultipleObjectsReturned, and NotUpdated\n \"\"\"\n Person.objects.create(name=\"[NAME_REDACTED]\")\n MyPerson.objects.create(name=\"Bazza del Frob\")\n@@ -118,6 +118,8 @@ def test_proxy_included_in_ancestors(self):\n MyPersonProxy.objects.get(id__lt=max_id + 1)\n with self.assertRaises(Person.DoesNotExist):\n StatusPerson.objects.get(name=\"Zathras\")\n+ with self.assertRaises(Person.NotUpdated), transaction.atomic():\n+ StatusPerson(id=999).save(update_fields={\"name\"})\n \n StatusPerson.objects.create(name=\"[NAME_REDACTED].\")\n StatusPerson.objects.create(name=\"[NAME_REDACTED].\")"
+ },
+ {
+ "filename": "tests/queryset_pickle/tests.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -70,6 +70,10 @@ def test_multipleobjectsreturned_class(self):\n klass = Event.MultipleObjectsReturned\n self.assertIs(pickle.loads(pickle.dumps(klass)), klass)\n \n+ def test_not_updated_class(self):\n+ klass = Event.NotUpdated\n+ self.assertIs(pickle.loads(pickle.dumps(klass)), klass)\n+\n def test_forward_relatedobjectdoesnotexist_class(self):\n # ForwardManyToOneDescriptor\n klass = Event.group.RelatedObjectDoesNotExist"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3744401904,
+ "user": "user_194c2ef4033e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T10:21:12+00:00"
+ },
+ {
+ "id": 3744430123,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T10:26:15+00:00"
+ },
+ {
+ "id": 3744508723,
+ "user": "user_194c2ef4033e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T10:40:55+00:00"
+ },
+ {
+ "id": 3744520811,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T10:42:56+00:00"
+ },
+ {
+ "id": 3744586202,
+ "user": "user_194c2ef4033e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T10:57:29+00:00"
+ },
+ {
+ "id": 3746154002,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T16:05:44+00:00"
+ },
+ {
+ "id": 3757416620,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-02-05T14:18:32+00:00"
+ },
+ {
+ "id": 3780801722,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-10T18:31:55+00:00"
+ },
+ {
+ "id": 3781971113,
+ "user": "user_194c2ef4033e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-10T22:30:40+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2758332665,
+ "user": "user_194c2ef4033e",
+ "body": "Curiously this works for `update_fields`, but not for `force_update` which gets overridden somehow as part of the MTI handling. Either that's a bug, or it needs to be documented... 🤔",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:20:46+00:00"
+ },
+ {
+ "id": 2758333882,
+ "user": "user_194c2ef4033e",
+ "body": "Ditto.",
+ "path": "tests/proxy_models/tests.py",
+ "line": 122,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:20:56+00:00"
+ },
+ {
+ "id": 2758354395,
+ "user": "user_081d78d226d7",
+ "body": "What exactly do you mean? What doesn't work?",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:25:17+00:00"
+ },
+ {
+ "id": 2758422846,
+ "user": "user_194c2ef4033e",
+ "body": "Sorry - Using `obj.save(force_update=True)` doesn't raise `NotUpdated` where we are using multi-table inheritance because the parent(s) is inserted first and that overrides the `force_insert` flag on the child:\n\nhttps://github.com/[USER_REDACTED]ngo/django/blob/24a14860ced5c456522d69c16afd2c631cc0456f/django/db/models/base.py#L980-L995\n\nThis means that `_save_table()` here is called with both `force_insert` and `force_update` set to `True`, but we don't do any further validation from this point onward. As `force_insert` is `True`, all handling of `force_update` is then ignored in `_save_table()` as we don't take the branch that handles that.\n\nWhen using `update_fields`, however, that is passed through to `_save_parents()` which then calls `_save_table()` and handles it properly.\n\nI suspect the fix would be to pass `force_update` through `_save_parents()`, but I haven't looked at that yet.",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:40:55+00:00"
+ },
+ {
+ "id": 2758433090,
+ "user": "user_081d78d226d7",
+ "body": "That seems like a legitimate bug, if that's the case. But oh dear, that's gonna break people's code :grimacing:",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:42:56+00:00"
+ },
+ {
+ "id": 2758491470,
+ "user": "user_194c2ef4033e",
+ "body": "It might be possible to fix - we'd need to raise a deprecation warning first for a number of releases. Anyway - will try to write that up as another ticket later.",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T10:57:29+00:00"
+ },
+ {
+ "id": 2759834869,
+ "user": "user_cdda8932ec17",
+ "body": "That's a nice catch but I suspect the intersections of users that\n\n1. Are creating model instances pointing at primary keys they expect to exist\n2. Are making use of MTI\n3. Are passing `force_update=True`\n\nIs pretty small which might explain why this slipped under the radar for so long (the ORM has been silently doing inserts in this case for a long time)\n\nIf we are going to address this issue we should also test interactions with `force_insert: tuple[type[Model]]` and `force_update=True` as I assume it's not a well covered area either.",
+ "path": "tests/model_inheritance/tests.py",
+ "line": 456,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T16:05:44+00:00"
+ },
+ {
+ "id": 2789583220,
+ "user": "user_657e90e5ae46",
+ "body": "This causes the next operation to fail on databases that don't support savepoints:\n```\n======================================================================\nERROR: test_proxy_included_in_ancestors (proxy_models.tests.ProxyModelTests.test_proxy_included_in_ancestors)\nProxy models are included in the ancestors for a model's DoesNotExist,\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/usr/lib/python3.12/unittest/case.py\", line 58, in testPartExecutor\n yield\n File \"/usr/lib/python3.12/unittest/case.py\", line 634, in run\n self._callTestMethod(testMethod)\n ^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.12/unittest/case.py\", line 589, in _callTestMethod\n if method() is not None:\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/tests/proxy_models/tests.py\", line 124, in test_proxy_included_in_ancestors\n StatusPerson.objects.create(name=\"[NAME_REDACTED].\")\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/manager.py\", line 87, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/query.py\", line 690, in create\n obj.save(force_insert=True, using=self.db)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/base.py\", line 896, in save\n self.save_base(\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/base.py\", line 985, in save_base\n parent_inserted = self._save_parents(\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/base.py\", line 1038, in _save_parents\n updated = self._save_table(\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/base.py\", line 1191, in _save_table\n results = self._do_insert(\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/base.py\", line 1243, in _do_insert\n return manager._insert(\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/manager.py\", line 87, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/query.py\", line 2013, in _insert\n return query.get_compiler(using=using).execute_sql(returning_fields)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/models/sql/compiler.py\", line 1939, in execute_sql\n cursor.execute(sql, params)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/backends/utils.py\", line 79, in execute\n return self._execute_with_wrappers(\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/backends/utils.py\", line 92, in _execute_with_wrappers\n return executor(sql, params, many, context)\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/backends/utils.py\", line 99, in _execute\n self.db.validate_no_broken_transaction()\n ^^^^^^^^^^^^^^^^^\n File \"/home/runner/work/django-snowflake/django-snowflake/django_repo/django/db/backends/base/base.py\", line 521, in validate_no_broken_transaction\n raise TransactionManagementError(\n ^^^^^^^^^^^^^^^^^\ndjango.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.\n```\nPossible solutions:\n- Skip this block if `DatabaseFeatures.uses_savepoints=False`.\n- Move this block to a separate test.",
+ "path": "tests/proxy_models/tests.py",
+ "line": 122,
+ "side": "RIGHT",
+ "created_at": "2026-02-10T18:31:55+00:00"
+ },
+ {
+ "id": 2790603115,
+ "user": "user_194c2ef4033e",
+ "body": "The whole test was a bit overloaded, so I split each thing being tested into separate tests: https://github.com/[USER_REDACTED]ngo/django/pull/20669",
+ "path": "tests/proxy_models/tests.py",
+ "line": 122,
+ "side": "RIGHT",
+ "created_at": "2026-02-10T22:30:39+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 8,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 8,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 9
+ }
+}
+{
+ "_id": "14833de8c3bb015a",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.525778+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20634,
+ "title": "Fixed #34352 -- Unified terms in Signals docs.",
+ "body": "#### Trac ticket number\n\n\n\nticket-34352\n\n#### Branch description\nremoved callback from the signals document for consistency & to avoid confusion\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_de355a7b8f22",
+ "created_at": "2026-02-03T08:20:37+00:00",
+ "merged_at": "2026-02-10T20:31:59+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_34352",
+ "additions": 15,
+ "deletions": 15,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "docs/topics/signals.txt",
+ "status": "modified",
+ "additions": 15,
+ "deletions": 15,
+ "changes": 30,
+ "patch": "@@ -18,15 +18,15 @@ changes::\n from django.core.signals import setting_changed\n \n \n- def my_callback(sender, **kwargs):\n+ def my_receiver(sender, **kwargs):\n print(\"Setting changed!\")\n \n \n class MyAppConfig(AppConfig):\n ...\n \n def ready(self):\n- setting_changed.connect(my_callback)\n+ setting_changed.connect(my_receiver)\n \n Django's :doc:`built-in signals ` let user code get notified of\n certain actions.\n@@ -58,7 +58,7 @@ the order they were registered.\n :param sender: Specifies a particular sender to receive signals from. See\n :ref:`connecting-to-specific-signals` for more information.\n \n- :param weak: Django stores signal handlers as weak references by\n+ :param weak: Django stores signal receivers as weak references by\n default. Thus, if your receiver is a local function, it may be\n garbage collected. To prevent this, pass ``weak=False`` when you call\n the signal's ``connect()`` method.\n@@ -79,19 +79,19 @@ Receiver functions\n First, we need to define a receiver function. A receiver can be any Python\n function or method::\n \n- def my_callback(sender, **kwargs):\n+ def my_receiver(sender, **kwargs):\n print(\"Request finished!\")\n \n Notice that the function takes a ``sender`` argument, along with wildcard\n-keyword arguments (``**kwargs``); all signal handlers must take these\n+keyword arguments (``**kwargs``); all signal receivers must take these\n arguments.\n \n We'll look at senders :ref:`a bit later `, but\n right now look at the ``**kwargs`` argument. All signals send keyword\n arguments, and may change those keyword arguments at any time. In the case of\n :data:`~django.core.signals.request_finished`, it's documented as sending no\n arguments, which means we might be tempted to write our signal handling as\n-``my_callback(sender)``.\n+``my_receiver(sender)``.\n \n This would be wrong -- in fact, Django will throw an error if you do so. That's\n because at any point arguments could get added to the signal and your receiver\n@@ -100,7 +100,7 @@ must be able to handle those new arguments.\n Receivers may also be asynchronous functions, with the same signature but\n declared using ``async def``::\n \n- async def my_callback(sender, **kwargs):\n+ async def my_receiver(sender, **kwargs):\n await asyncio.sleep(5)\n print(\"Request finished!\")\n \n@@ -118,7 +118,7 @@ manual connect route::\n \n from django.core.signals import request_finished\n \n- request_finished.connect(my_callback)\n+ request_finished.connect(my_receiver)\n \n Alternatively, you can use a :func:`receiver` decorator:\n \n@@ -135,24 +135,24 @@ Here's how you connect with the decorator::\n \n \n [USER_REDACTED](request_finished)\n- def my_callback(sender, **kwargs):\n+ def my_receiver(sender, **kwargs):\n print(\"Request finished!\")\n \n-Now, our ``my_callback`` function will be called each time a request finishes.\n+Now, our ``my_receiver`` function will be called each time a request finishes.\n \n .. admonition:: Where should this code live?\n \n Strictly speaking, signal handling and registration code can live anywhere\n you like, although it's recommended to avoid the application's root module\n and its ``models`` module to minimize side-effects of importing code.\n \n- In practice, signal handlers are usually defined in a ``signals``\n+ In practice, signal receivers are usually defined in a ``signals``\n submodule of the application they relate to. Signal receivers are\n connected in the :meth:`~django.apps.AppConfig.ready` method of your\n application :ref:`configuration class `. If\n you're using the :func:`receiver` decorator, import the ``signals``\n submodule inside :meth:`~django.apps.AppConfig.ready`, this will implicitly\n- connect signal handlers::\n+ connect signal receivers::\n \n from django.apps import AppConfig\n from django.core.signals import request_finished\n@@ -162,11 +162,11 @@ Now, our ``my_callback`` function will be called each time a request finishes.\n ...\n \n def ready(self):\n- # Implicitly connect signal handlers decorated with [USER_REDACTED].\n+ # Implicitly connect signal receivers decorated with [USER_REDACTED].\n from . import signals\n \n # Explicitly connect a signal handler.\n- request_finished.connect(signals.my_callback)\n+ request_finished.connect(signals.my_receiver)\n \n .. note::\n \n@@ -228,7 +228,7 @@ bound to the signal once for each unique ``dispatch_uid`` value::\n \n from django.core.signals import request_finished\n \n- request_finished.connect(my_callback, dispatch_uid=\"my_unique_identifier\")\n+ request_finished.connect(my_receiver, dispatch_uid=\"my_unique_identifier\")\n \n .. _defining-and-sending-signals:"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3758065387,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-05T16:13:55+00:00"
+ },
+ {
+ "id": 3781413724,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "👍",
+ "submitted_at": "2026-02-10T20:29:46+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2769972672,
+ "user": "user_3a67c55598c5",
+ "body": "I would make a single exception here and continue to use \"callback\", as otherwise, we're explaining the term X by [NAME_REDACTED] By using a synonym, there's a chance a user can rely on some prior knowledge or gain new knowledge.\n\nAnother possibility is to use both, e.g. \"The receiver (callback) function that will ...\"",
+ "path": "docs/topics/signals.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-05T16:10:45+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "7e0ad94f091976fe",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.526779+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20628,
+ "title": "Fixed #36890 -- [NAME_REDACTED](distinct=True) on SQLite with the default delimiter.",
+ "body": "#### Trac ticket number\n\n\n\nticket-36890\n\n#### Branch description\nCurrently, the generic StringAgg function raises an error on SQLite when distinct=True\n\nThis change enables support for distinct aggregation on SQLite by [NAME_REDACTED] in the generated SQL when it matches the default comma.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [ ] **No AI tools were used** in preparing this PR.\n- [X] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\nI used [NAME_REDACTED] to assist with writing tests.\n\n#### Checklist\n- [X] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [X] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [X] This PR targets the `main` branch. \n- [X] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [X] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_95f516637e24",
+ "created_at": "2026-02-02T08:23:43+00:00",
+ "merged_at": "2026-02-10T21:47:45+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-36890",
+ "additions": 41,
+ "deletions": 2,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/db/models/aggregates.py",
+ "status": "modified",
+ "additions": 18,
+ "deletions": 0,
+ "changes": 18,
+ "patch": "@@ -369,6 +369,24 @@ def as_mysql(self, compiler, connection, **extra_context):\n return sql, (*params, *delimiter_params)\n \n def as_sqlite(self, compiler, connection, **extra_context):\n+ if (\n+ self.distinct\n+ and isinstance(self.delimiter.value, Value)\n+ and self.delimiter.value.value == \",\"\n+ ):\n+ clone = self.copy()\n+ source_expressions = clone.get_source_expressions()\n+ clone.set_source_expressions(\n+ source_expressions[:1] + source_expressions[2:]\n+ )\n+\n+ return clone.as_sql(\n+ compiler,\n+ connection,\n+ function=\"GROUP_CONCAT\",\n+ **extra_context,\n+ )\n+\n if connection.get_database_version() < (3, 44):\n return self.as_sql(\n compiler,"
+ },
+ {
+ "filename": "docs/ref/models/querysets.txt",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 1,
+ "changes": 9,
+ "patch": "@@ -4175,7 +4175,14 @@ by [NAME_REDACTED]\n .. attribute:: delimiter\n \n A ``Value`` or expression representing the string that should separate\n- each of the values. For example, ``Value(\",\")``.\n+ each of the values. For example, ``Value(\",\")``. (On SQLite, the\n+ literal delimiter ``Value(\",\")`` is the only delimiter compatible with\n+ ``distinct=True``.)\n+\n+ .. versionchanged:: 6.1\n+\n+ Support for using ``distinct=True`` with a delimiter of\n+ ``Value(\",\")`` on SQLite was added.\n \n Query-related tools\n ==================="
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -284,6 +284,9 @@ Models\n * The :data:`~django.db.models.signals.m2m_changed` signal now receives a\n ``raw`` argument.\n \n+* :class:`~django.db.models.StringAgg` now supports ``distinct=True`` on SQLite\n+ when using the default delimiter ``Value(\",\")`` only.\n+\n Pagination\n ~~~~~~~~~~"
+ },
+ {
+ "filename": "tests/aggregation/tests.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 1,
+ "changes": 13,
+ "patch": "@@ -3,6 +3,7 @@\n import re\n from decimal import Decimal\n from itertools import chain\n+from unittest import skipUnless\n \n from django.core.exceptions import FieldError\n from django.db import NotSupportedError, connection\n@@ -579,6 +580,16 @@ def test_distinct_on_stringagg(self):\n )\n self.assertCountEqual(books[\"ratings\"].split(\",\"), [\"3\", \"4\", \"4.5\", \"5\"])\n \n+ [USER_REDACTED](connection.vendor == \"sqlite\", \"Special default case for SQLite.\")\n+ def test_distinct_on_stringagg_sqlite_special_case(self):\n+ \"\"\"\n+ Value(\",\") is the only delimiter usable on SQLite with distinct=True.\n+ \"\"\"\n+ books = Book.objects.aggregate(\n+ ratings=StringAgg(Cast(F(\"rating\"), CharField()), Value(\",\"), distinct=True)\n+ )\n+ self.assertCountEqual(books[\"ratings\"].split(\",\"), [\"3.0\", \"4.0\", \"4.5\", \"5.0\"])\n+\n [USER_REDACTED](\"supports_aggregate_distinct_multiple_argument\")\n def test_raises_error_on_multiple_argument_distinct(self):\n message = (\n@@ -589,7 +600,7 @@ def test_raises_error_on_multiple_argument_distinct(self):\n Book.objects.aggregate(\n ratings=StringAgg(\n Cast(F(\"rating\"), CharField()),\n- Value(\",\"),\n+ Value(\";\"),\n distinct=True,\n )\n )"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3740360959,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-02T15:56:43+00:00"
+ },
+ {
+ "id": 3775494074,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-09T21:35:18+00:00"
+ },
+ {
+ "id": 3775592950,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks 👍",
+ "submitted_at": "2026-02-09T21:54:28+00:00"
+ },
+ {
+ "id": 3775608120,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-09T21:58:51+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2755046559,
+ "user": "user_cdda8932ec17",
+ "body": "This lacks `order_by` and `filter`",
+ "path": "django/db/models/aggregates.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-02T15:55:32+00:00"
+ },
+ {
+ "id": 2755051293,
+ "user": "user_cdda8932ec17",
+ "body": "```suggestion\n if (\n self.distinct\n and isinstance(self.delimiter.value, Value)\n and self.delimiter.value.value == \",\"\n ):\n return ...\n```",
+ "path": "django/db/models/aggregates.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-02T15:56:28+00:00"
+ },
+ {
+ "id": 2784636581,
+ "user": "user_3a67c55598c5",
+ "body": "It's too bad we can't provide a better hint for SQLite users in this case, but I don't know what we can do about it without departing from our existing patterns.",
+ "path": "tests/aggregation/tests.py",
+ "line": 603,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T21:35:18+00:00"
+ },
+ {
+ "id": 2784723845,
+ "user": "user_3a67c55598c5",
+ "body": "Simon's prior feedback for you was to avoid asserting over the exact stringified values, but once I realized that we _don't_ want this test to run on all databases (what about other databases besides SQLite where supports_aggregate_distinct_multiple_argument is also False, but the default delimiter trick may not work), I realized we were only testing a SQLite specific case.\n\nGiven that, I shuffled this test location and made it as parallel as possible to the prior one.",
+ "path": "tests/aggregation/tests.py",
+ "line": 591,
+ "side": "RIGHT",
+ "created_at": "2026-02-09T21:58:51+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "de327d05ef61056e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.527778+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20614,
+ "title": "Fixed #36893 -- Serialized elidable kwarg for RunSQL and RunPython operations.",
+ "body": "#### Trac ticket number\n\n\n\nticket-36893\n\n#### Branch description\n\nFixed an issue where `elidable=True` was not being serialized for Run-SQL and Run-Python operations which caused these operations to lose their elidable status when written to a migration file (e.g., during squashing), reverting to the default `False`.\n\n-Updated deconstruct() for both Run-SQL and Run-Python to correctly include 'elidable' keyword when set to 'True' \n-[NAME_REDACTED] are test_run_sql_elidable , test_run_python_elidable and test_operations.py\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [ ] **No AI tools were used** in preparing this PR.\n- [x] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\nAssistance provided by [NAME_REDACTED] I used the agent to understand the issue, implement the fix, and add regression tests.\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_ff4c0b4e0209",
+ "created_at": "2026-01-30T05:32:49+00:00",
+ "merged_at": "2026-02-03T02:05:44+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36893_fix_elidable_serialization",
+ "additions": 12,
+ "deletions": 0,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/db/migrations/operations/special.py",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -93,6 +93,8 @@ def deconstruct(self):\n kwargs[\"state_operations\"] = self.state_operations\n if self.hints:\n kwargs[\"hints\"] = self.hints\n+ if self.elidable:\n+ kwargs[\"elidable\"] = self.elidable\n return (self.__class__.__qualname__, [], kwargs)\n \n [USER_REDACTED]\n@@ -173,6 +175,8 @@ def deconstruct(self):\n kwargs[\"atomic\"] = self.atomic\n if self.hints:\n kwargs[\"hints\"] = self.hints\n+ if self.elidable:\n+ kwargs[\"elidable\"] = self.elidable\n return (self.__class__.__qualname__, [], kwargs)\n \n [USER_REDACTED]"
+ },
+ {
+ "filename": "tests/migrations/test_operations.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -5536,6 +5536,10 @@ def test_run_sql(self):\n elidable_operation = migrations.RunSQL(\"SELECT 1 FROM void;\", elidable=True)\n self.assertEqual(elidable_operation.reduce(operation, []), [operation])\n \n+ # Test elidable deconstruction\n+ definition = elidable_operation.deconstruct()\n+ self.assertIs(definition[2][\"elidable\"], True)\n+\n def test_run_sql_params(self):\n \"\"\"\n #23426 - RunSQL should accept parameters.\n@@ -5789,6 +5793,10 @@ def create_shetlandponies(models, schema_editor):\n elidable_operation = migrations.RunPython(inner_method, elidable=True)\n self.assertEqual(elidable_operation.reduce(operation, []), [operation])\n \n+ # Test elidable deconstruction\n+ definition = elidable_operation.deconstruct()\n+ self.assertIs(definition[2][\"elidable\"], True)\n+\n def test_run_python_invalid_reverse_code(self):\n msg = \"RunPython must be supplied with callable arguments\"\n with self.assertRaisesMessage(ValueError, msg):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3726671276,
+ "user": "user_bc02c4664e11",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T06:51:36+00:00"
+ },
+ {
+ "id": 3726710585,
+ "user": "user_ff4c0b4e0209",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T07:01:14+00:00"
+ },
+ {
+ "id": 3728783340,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED] and [USER_REDACTED] for the review.\n\nVery nearly there, one small cleanup suggestion. And please update the PR title to match the commit. Thanks.",
+ "submitted_at": "2026-01-30T14:51:56+00:00"
+ },
+ {
+ "id": 3741227562,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks 👍",
+ "submitted_at": "2026-02-02T18:33:32+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2744906431,
+ "user": "user_bc02c4664e11",
+ "body": "Probs don't need an explicit test for just `elidable` param.\nIs there already a test somewhere that checks _all_ serialized params for RunSQL? I'd probs ensure we have one that does that, and include elidable as part of its check.",
+ "path": "tests/migrations/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T06:51:36+00:00"
+ },
+ {
+ "id": 2744939359,
+ "user": "user_ff4c0b4e0209",
+ "body": "Thanks for the feedback! I've updated the PR to remove the separate test case. I found that test_run_sqland and test_run_python\nwere already creating elidable operations for reduction testing, so I added assertions there to verify they also deconstruct correctly with the elidable keyword.",
+ "path": "tests/migrations/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T07:01:14+00:00"
+ },
+ {
+ "id": 2746658035,
+ "user": "user_3a67c55598c5",
+ "body": "Similar change here.",
+ "path": "tests/migrations/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T14:50:22+00:00"
+ },
+ {
+ "id": 2746661936,
+ "user": "user_3a67c55598c5",
+ "body": "One assertion for this is fine, also please use `assertIs` for first-party values:\n```suggestion\n self.assertIs(definition[2][\"elidable\"], True)\n```",
+ "path": "tests/migrations/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T14:51:21+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "51fcd4d9cc3a5a06",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.529432+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20610,
+ "title": "Fixed spell checks in GH docs workflow.",
+ "body": "#### Branch description\nThe spelling check job was passing even with spelling errors because\nthe system spell checker (`aspell`) was not installed on the [NAME_REDACTED] runner. While `sphinxcontrib.spelling` and `PyEnchant` were\ninstalled via pip, they require a system-level spell checker backend\nto function.\n\nOnce installed, these errors were reported:\n\n```\nWARNING: internals/security.txt:50: : Spell check: runnable: Include a runnable proof of concept.\nWARNING: ref/contrib/postgres/search.txt:292: : Spell check: lexeme: an untrusted source. The content of each lexeme is escaped so that any.\nWARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .\nWARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .\nWARNING: ref/contrib/postgres/search.txt:314: : Spell check: Lexeme: Lexeme objects also support term weighting and prefixes:.\nWARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..\nWARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..\nWARNING: ref/models/expressions.txt:439: : Spell check: positionally: can be supplied positionally or only by keyword. For.\nWARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).\nWARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).\nWARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.\nWARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.\nWARNING: releases/4.2.21.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..\nWARNING: releases/5.1.9.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..\nWARNING: releases/5.2.1.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..\nWARNING: releases/6.1.txt:244: : Spell check: mistyped: suggestions for mistyped subcommand names and argument choices..\nWARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..\nWARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..\nWARNING: releases/6.1.txt:343: : Spell check: durations: durations expressed in weeks (.\nWARNING: Found 19 misspelled words\nbuild finished with problems, 20 warnings (with warnings treated as errors).\n```\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [ ] **No AI tools were used** in preparing this PR.\n- [X] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\nI have used [NAME_REDACTED] with model Sonnet 4.5 for debugging the root cause of this issue.\n\n#### Checklist\n- [X] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [X] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [X] This PR targets the `main` branch. \n- [X] The commit message is written in past tense, mentions the ticket number, and ends with a period.",
+ "author": "user_00dac951cdbf",
+ "created_at": "2026-01-29T02:02:12+00:00",
+ "merged_at": "2026-01-29T14:20:12+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-spelling-ubuntu-noble",
+ "additions": 18,
+ "deletions": 11,
+ "changed_files": 6,
+ "files": [
+ {
+ "filename": ".github/workflows/docs.yml",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 0,
+ "changes": 2,
+ "patch": "@@ -35,6 +35,8 @@ jobs:\n python-version: '3.14'\n cache: 'pip'\n cache-dependency-path: 'docs/requirements.txt'\n+ - name: Install system spell checker\n+ run: sudo apt update && sudo apt install -y aspell aspell-en\n - run: python -m pip install -r docs/requirements.txt\n - name: Build docs\n run: |"
+ },
+ {
+ "filename": "docs/internals/contributing/writing-documentation.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 2,
+ "changes": 5,
+ "patch": "@@ -178,8 +178,9 @@ Spelling check\n ~~~~~~~~~~~~~~\n \n Before you commit your docs, it's a good idea to run the spelling checker.\n-You'll need to install :pypi:`sphinxcontrib-spelling` first. Then from the\n-``docs`` directory, run:\n+You'll need to install :pypi:`sphinxcontrib-spelling` first. The spell checker\n+also requires a system-level spell checking backend such as `Aspell\n+ `__. Then from the ``docs`` directory, run:\n \n .. console::"
+ },
+ {
+ "filename": "docs/internals/security.txt",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -46,8 +46,8 @@ the industry-standard 90 days. Confirmed vulnerabilities with a\n Reporting guidelines\n --------------------\n \n-Include a runnable proof of concept\n-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+Include a working proof of concept\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n Please privately share a minimal Django project or code snippet that\n demonstrates the potential vulnerability. Include clear instructions on how to"
+ },
+ {
+ "filename": "docs/ref/models/expressions.txt",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 5,
+ "changes": 10,
+ "patch": "@@ -438,11 +438,11 @@ return type.\n \n Built-in database functions (such as\n :class:`~django.db.models.functions.Cast`) vary in whether arguments such\n- as ``output_field`` can be supplied positionally or only by keyword. For\n- ``output_field`` and several other cases, the input ultimately reaches\n- ``Func()`` as a keyword argument, so the advice to avoid constructing\n- keyword arguments from untrusted user input applies as equally to these\n- arguments as it does to ``**extra``.\n+ as ``output_field`` can be supplied as positional arguments or only by\n+ keyword. For ``output_field`` and several other cases, the input ultimately\n+ reaches ``Func()`` as a keyword argument, so the advice to avoid\n+ constructing keyword arguments from untrusted user input applies as equally\n+ to these arguments as it does to ``**extra``.\n \n ``Aggregate()`` expressions\n ---------------------------"
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -242,7 +242,7 @@ [NAME_REDACTED]\n \n * Management commands now set :class:`~argparse.ArgumentParser`\\'s\n ``suggest_on_error`` argument to ``True`` by [NAME_REDACTED] 3.14, enabling\n- suggestions for mistyped subcommand names and argument choices.\n+ suggestions for incorrectly typed subcommand names and argument choices.\n \n * The :djadmin:`loaddata` command now calls\n :data:`~django.db.models.signals.m2m_changed` signals with ``raw=True`` when\n@@ -340,7 +340,7 @@ Utilities\n ~~~~~~~~~\n \n * :func:`~django.utils.dateparse.parse_duration` now supports ISO 8601\n- durations expressed in weeks (``PnW``).\n+ time periods expressed in weeks (``PnW``).\n \n Validators\n ~~~~~~~~~~"
+ },
+ {
+ "filename": "docs/spelling_wordlist",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -4,6 +4,7 @@ accessors\n Aceh\n admindocs\n affordances\n+ai\n [NAME_REDACTED]\n allowlist\n@@ -245,6 +246,8 @@ kwargs\n Kyrgyz\n latin\n lawrence\n+lexeme\n+lexemes\n Libera\n lifecycle\n lifecycles\n@@ -531,6 +534,7 @@ unapplied\n unapplying\n uncategorized\n unclaim\n+unclosed\n uncopyable\n unencoded\n unencrypted"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3722192099,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-29T11:55:08+00:00"
+ },
+ {
+ "id": 3722594201,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T13:06:20+00:00"
+ },
+ {
+ "id": 3722595929,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T13:06:47+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2741226263,
+ "user": "user_3a67c55598c5",
+ "body": "positional parameters -> positional arguments",
+ "path": "docs/ref/models/expressions.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T11:40:29+00:00"
+ },
+ {
+ "id": 2741275863,
+ "user": "user_3a67c55598c5",
+ "body": "Wonderful. Are you up for updating the section on this in writing-documentation.txt that aspell is required?\n\nOn mac, sphinxcontrib.spelling exits with an instruction to install enchant, which, at least via homebrew, pulls in aspell. Guess not on linux?",
+ "path": ".github/workflows/docs.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T11:54:48+00:00"
+ },
+ {
+ "id": 2741556409,
+ "user": "user_00dac951cdbf",
+ "body": "Applied, thanks!",
+ "path": "docs/ref/models/expressions.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T13:06:20+00:00"
+ },
+ {
+ "id": 2741558158,
+ "user": "user_00dac951cdbf",
+ "body": "I added a new commit with this adding. Good call! :dart:",
+ "path": ".github/workflows/docs.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T13:06:47+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "9d5f16bd4ce84b3f",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.533485+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20599,
+ "title": "Added documentation on reviewing patches.",
+ "body": "This was primarily sourced from [NAME_REDACTED] talk, \"Django needs you! (to do code review)\"\nSource: https://www.youtube.com/watch?v=MBqampUQ1o0\n\n#### Trac ticket number\n\n\n\nN/A\n\n#### Branch description\nThis adds a brief overview of how to review patches to the documentation. Having something defined for doing code reviews should make this part of the software development process more accessible to other developers.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [ ] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_6b79e26637e6",
+ "created_at": "2026-01-27T17:44:58+00:00",
+ "merged_at": "2026-01-31T01:48:59+00:00",
+ "base_branch": "main",
+ "head_branch": "code-review-documentation",
+ "additions": 112,
+ "deletions": 6,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "docs/internals/contributing/triaging-tickets.txt",
+ "status": "modified",
+ "additions": 109,
+ "deletions": 6,
+ "changes": 115,
+ "patch": "@@ -63,15 +63,19 @@ vote of the :ref:`[NAME_REDACTED] `.\n * Bug fixers: anyone can contribute by opening a pull request and working on a\n solution for a ticket.\n \n-* Reviewers: anyone can review pull requests and suggest improvements.\n+* Reviewers: anyone can :ref:`review pull requests ` and\n+ suggest improvements.\n \n * Mergers: people with commit access who make the final decision to merge a\n change.\n \n-[NAME_REDACTED] system is intentionally open to the public, and anyone can help by\n-working on tickets. Django is a community project, and we encourage\n-:ref:`triage and collaboration by [NAME_REDACTED]\n-`. This could be you!\n+.. admonition:: When we say anyone, we mean you!\n+\n+ [NAME_REDACTED] system and GitHub repositories are intentionally open to the\n+ public. Anyone can help by [NAME_REDACTED], triaging tickets and\n+ reviewing changes. Django is a community project, and we encourage\n+ :ref:`triage and collaboration by [NAME_REDACTED]\n+ `. We truly want you to help!\n \n For example, here's the typical lifecycle of a ticket:\n \n@@ -414,7 +418,7 @@ the ticket database:\n * Please **don't** promote your own tickets to \"Ready for checkin\". You\n may mark other people's tickets that you've reviewed as \"Ready for\n checkin\", but you should get at minimum one other community member to\n- review a patch that you submit.\n+ :ref:`review a patch ` that you submit.\n \n * Please **don't** reverse a decision without posting a message to the\n `[NAME_REDACTED]`_ to find consensus.\n@@ -484,3 +488,102 @@ commit where the test fails.\n Now, report your results on the Trac ticket, and please include the regression\n test as an attachment. When someone writes a fix for the bug, they'll already\n have your test as a starting point.\n+\n+.. _reviewing-patches:\n+\n+Reviewing patches\n+=================\n+\n+A great way to learn the Django codebase is to help review patches. It allows\n+you to focus on a fixed scope of Django with a particular perspective. Plus,\n+Django tends to receive more patches than it can review which causes the\n+`review queue`_ to build up. Contributors can help Django tremendously by\n+reviewing patches.\n+\n+The `review queue`_ is defined by [NAME_REDACTED]_ that are in the \"Accepted\"\n+state with the flag \"has patch\" set and the flags \"patch needs improvement\",\n+\"needs tests\" and \"needs documentation\" unset. There is also a set of\n+`Pull Requests in GitHub with the \"no ticket\" label`_ that can be reviewed.\n+\n+Code review process\n+-------------------\n+\n+The general process to reviewing a patch for Django is as follows:\n+\n+1. Pick a patch to review. This can be from the `review queue`_ or the\n+ `Pull Requests in GitHub with the \"no ticket\" label`_. If you're new, pick\n+ a specific component to stick with. Django is a big codebase, so it's best\n+ to contribute consistently with a narrow focus and grow it slowly.\n+\n+2. Pull the branch. See the :ref:`handling-pull-requests`, including the git\n+ alias to make checking out other pull requests easier.\n+\n+3. Check the tests. If the ticket is for a bug, there should be a regression\n+ test. Confirm that the test fails if the change is reverted. Check that the\n+ tests are adequately covering the code and logic as well. See\n+ :ref:`patch-review-checklist`.\n+\n+4. Test in your own Django project. See :ref:`installing-development-version`\n+ for how. Explore the user interface and user experience with the change.\n+ Does it feel right? Can you break it? Another approach is to assume\n+ everything is wrong. Can you demonstrate to yourself that each piece is\n+ correct?\n+\n+5. Check the documentation. Is the documentation understandable? Does it\n+ provide the information the reader needs at that moment? Does it read well?\n+ Is it consistent with the documentation before and after it? See\n+ :ref:`build-documentation-locally`.\n+\n+6. Are you happy with the patch? This is fairly subjective, but that's fine.\n+ You should ask, does the approach make sense to you and is there another\n+ way to do it that's better? Also ask yourself, is the scope of the change\n+ appropriate? Are things named appropriately? Renaming things is slow and\n+ challenging in Django, so we should try to get it right from the start.\n+ Are there backwards compatibility concerns? Lastly, are there any other\n+ general concerns such as things that may worry you or that should be looked\n+ into?\n+\n+7. Review your feedback. Before you submit your feedback, consider the\n+ feedback you want to share. It takes courage to open a Pull Request, we\n+ should be thoughtful and considerate of the leap the author [NAME_REDACTED]\n+ there are nitpicky or small suggestions, use GitHub's suggestion feature.\n+ If the approach isn't what you expected, consider asking the author why\n+ before requesting several changes. Seek to understand their reasoning\n+ first.\n+\n+8. Submit feedback on GitHub and update flags, \"patch needs improvement\",\n+ \"needs tests\", and \"needs documentation\", as needed. This will move the\n+ ticket to the `\"waiting for author\" queue`_. If you have given a\n+ specific type of code review, please indicate that on the Pull Request.\n+\n+Types of code reviews\n+---------------------\n+\n+Not everyone will or should give the same type of code review. Having a diverse\n+set of opinions and experiences helps Django be better. If you are providing a\n+specific review, please indicate that on the Pull Request in GitHub. Below\n+are some of the types of code review you can perform:\n+\n+* Accessibility review. Does it conform to our :ref:`accessibility-standards`?\n+\n+* :ref:`Patch style ` and contribution process review.\n+\n+* Usability and developer experience review.\n+\n+ * Use the change and provide feedback from that experience.\n+\n+ * Are the APIs and documentation accessible and well explained?\n+\n+* Domain expertise review. Do you have a personal expertise that is relevant\n+ such as databases, HTTP, security, etc?\n+\n+* Benchmarking and performance review. There are benchmarking tests, but\n+ sometimes changes require additional testing.\n+\n+ * Utilize :ref:`django-asv-benchmarks` to check performance over time.\n+\n+ * Run benchmark tests by [NAME_REDACTED] with \"benchmark\".\n+\n+.. _review queue: https://code.djangoproject.com/query?has_patch=1&needs_better_patch=0&needs_docs=0&needs_tests=0&stage=Accepted&status=!closed&order=changetime&desc=1\n+.. _Pull Requests in GitHub with the \"no ticket\" label: https://github.com/[USER_REDACTED]ngo/django/pulls?q=is%3Aopen+is%3Apr+label%3A%22no+ticket%22\n+.. _\"waiting for author\" queue: https://code.djangoproject.com/query?has_patch=1&needs_better_patch=1&stage=Accepted&status=assigned&status=new&or&has_patch=1&needs_docs=1&stage=Accepted&status=assigned&status=new&or&has_patch=1&needs_tests=1&stage=Accepted&status=assigned&status=new&order=changetime&desc=1"
+ },
+ {
+ "filename": "docs/internals/contributing/writing-documentation.txt",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 0,
+ "changes": 2,
+ "patch": "@@ -124,6 +124,8 @@ Create and activate a virtual environment, then install the dependencies:\n $ source .venv/bin/activate\n $ python -m pip install -r docs/requirements.txt\n \n+.. _build-documentation-locally:\n+\n Build the documentation locally\n -------------------------------"
+ },
+ {
+ "filename": "docs/spelling_wordlist",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -313,6 +313,7 @@ needsinfo\n needsnewfeatureprocess\n německy\n nginx\n+nitpicky\n noding\n nonces\n nonnegative"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3724244848,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks, Tim. This is my favorite subject, so unsurprisingly I have a few ideas for you to consider, but THANK YOU for encouraging people to jump in 🤝",
+ "submitted_at": "2026-01-29T18:28:59+00:00"
+ },
+ {
+ "id": 3724389089,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T18:37:07+00:00"
+ },
+ {
+ "id": 3724411558,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T18:43:21+00:00"
+ },
+ {
+ "id": 3724412462,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T18:43:36+00:00"
+ },
+ {
+ "id": 3724416015,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T18:44:33+00:00"
+ },
+ {
+ "id": 3724418777,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T18:45:20+00:00"
+ },
+ {
+ "id": 3729021213,
+ "user": "user_8d47d9546a2c",
+ "state": "COMMENTED",
+ "body": "[USER_REDACTED] This is awesome! It brings a lot of clarity to reviews.\n\nI wasn't sure if the Django documentation is the place to put them, but wondered if it would help to reference videos of code reviews.",
+ "submitted_at": "2026-01-30T15:49:36+00:00"
+ },
+ {
+ "id": 3729390079,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T16:51:39+00:00"
+ },
+ {
+ "id": 3730537535,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:49:36+00:00"
+ },
+ {
+ "id": 3730561296,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:54:27+00:00"
+ },
+ {
+ "id": 3730562230,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:54:37+00:00"
+ },
+ {
+ "id": 3730564231,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:55:02+00:00"
+ },
+ {
+ "id": 3730565059,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:55:10+00:00"
+ },
+ {
+ "id": 3730570895,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:56:16+00:00"
+ },
+ {
+ "id": 3730571856,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:56:30+00:00"
+ },
+ {
+ "id": 3730573727,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:56:50+00:00"
+ },
+ {
+ "id": 3730574835,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:57:03+00:00"
+ },
+ {
+ "id": 3730588168,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T21:59:46+00:00"
+ },
+ {
+ "id": 3730605686,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:03:41+00:00"
+ },
+ {
+ "id": 3730614920,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:05:49+00:00"
+ },
+ {
+ "id": 3730674046,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:20:32+00:00"
+ },
+ {
+ "id": 3730674637,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:20:42+00:00"
+ },
+ {
+ "id": 3731264666,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-31T01:38:00+00:00"
+ },
+ {
+ "id": 3731267315,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "I really like how this turned out, thanks for indulging me.\n\nThanks [USER_REDACTED] for having a look!",
+ "submitted_at": "2026-01-31T01:40:36+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2742873491,
+ "user": "user_3a67c55598c5",
+ "body": "nit: mix of quoted/unquoted and casing here.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:03:34+00:00"
+ },
+ {
+ "id": 2742876601,
+ "user": "user_3a67c55598c5",
+ "body": "no ticket -> \"no ticket\"",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:04:14+00:00"
+ },
+ {
+ "id": 2742885545,
+ "user": "user_3a67c55598c5",
+ "body": "Link to the patch review checklist? (\"For more specifics...\" )I get that we're describing something more holistic here, but there are some nice goodies over there, and cross-linking could be nice.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:06:24+00:00"
+ },
+ {
+ "id": 2742901187,
+ "user": "user_3a67c55598c5",
+ "body": "Take or leave this teeny suggestion, but I'd move the \"check all the rules\" bit into somewhere else (maybe where we link the review checklist) and leave this one more focused on \"use your judgment\"\n\n\"Use your judgment\" is very different from \"did it follow the letter of every rule\", which a computer can do.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 537,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:09:13+00:00"
+ },
+ {
+ "id": 2742906678,
+ "user": "user_3a67c55598c5",
+ "body": "Mention backward compatibility considerations?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:10:29+00:00"
+ },
+ {
+ "id": 2742908772,
+ "user": "user_3a67c55598c5",
+ "body": "\"is or should\" needs rewording.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:11:04+00:00"
+ },
+ {
+ "id": 2742910676,
+ "user": "user_3a67c55598c5",
+ "body": "On first read I didn't grok the connection the following list, a colon might help?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:11:32+00:00"
+ },
+ {
+ "id": 2742912171,
+ "user": "user_3a67c55598c5",
+ "body": "Type annotations are not used? 😉",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:11:56+00:00"
+ },
+ {
+ "id": 2742913681,
+ "user": "user_3a67c55598c5",
+ "body": "This part starts to feel a little repetitive.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:12:21+00:00"
+ },
+ {
+ "id": 2742915697,
+ "user": "user_3a67c55598c5",
+ "body": "I'd continue using \"?\" for all questions here and below.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:12:55+00:00"
+ },
+ {
+ "id": 2742916878,
+ "user": "user_3a67c55598c5",
+ "body": "Do we have any contributor docs about that? 🤔",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 580,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:13:16+00:00"
+ },
+ {
+ "id": 2742928578,
+ "user": "user_3a67c55598c5",
+ "body": "One memorable part of Sarah's talk for me was the bit about how you really must pull the branch instead of only reading the diff, since \"you're buying the house.\" Inspire yourself to do a thorough review by [NAME_REDACTED] shoes of the people who will maintain it forever. Would you buy a house sight unseen?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 519,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:16:33+00:00"
+ },
+ {
+ "id": 2742937253,
+ "user": "user_3a67c55598c5",
+ "body": "[NAME_REDACTED] has a nice blog post about \"checking yourself\" to avoid grabbing the steering wheel during PR review. Have you heard of him?\n\n(I'm inviting you to sneak in something about that -- try not to leave feedback that reduces to \"my way is much better\", rather leave feedback oriented around blending in, conservatism, resilience to change, etc.)",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:19:08+00:00"
+ },
+ {
+ "id": 2742951733,
+ "user": "user_3a67c55598c5",
+ "body": "Another helpful fiction I often use (and I've heard Natalia use): Assume everything is wrong. Can you demonstrate to yourself that each piece is correct?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:23:30+00:00"
+ },
+ {
+ "id": 2742959099,
+ "user": "user_3a67c55598c5",
+ "body": "Anything we can do to underline that we really, actually mean this would be huge.\n\nMy gut says if we took a poll, 99% of folks would say no one should bother trying to review a Django PR without \"being on the team\" (which is false!)",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:25:54+00:00"
+ },
+ {
+ "id": 2742961587,
+ "user": "user_3a67c55598c5",
+ "body": "Put your hands in the clay, make changes in the diff and rerun the workflow.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 519,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:26:41+00:00"
+ },
+ {
+ "id": 2742995237,
+ "user": "user_6b79e26637e6",
+ "body": "The only thing I know about it is https://github.com/[USER_REDACTED]ngo/django-asv. There's also the label that can be applied to run the benchmark tests. That definitely feels like something we should document.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 580,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:37:07+00:00"
+ },
+ {
+ "id": 2743015217,
+ "user": "user_3a67c55598c5",
+ "body": "Somewhere in our docs we have \"Be bold! Leave feedback!\" People need to hear that, so I don't mind repeating it.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:43:21+00:00"
+ },
+ {
+ "id": 2743016039,
+ "user": "user_6b79e26637e6",
+ "body": "Let me make another attempt at this piece. When I originally wrote this I had the wrong understanding of community reviews. With the understanding that any community reviewer could enable a Merger to merge a PR, I can put a bit more \"umph\" to this.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:43:36+00:00"
+ },
+ {
+ "id": 2743019239,
+ "user": "user_6b79e26637e6",
+ "body": "[NAME_REDACTED] fact that you have read that and referenced it is amazing. Thank you for that.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:44:32+00:00"
+ },
+ {
+ "id": 2743021680,
+ "user": "user_6b79e26637e6",
+ "body": ":melting_face: Should I remove this line or make it \"not used\"?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T18:45:20+00:00"
+ },
+ {
+ "id": 2746861488,
+ "user": "user_8d47d9546a2c",
+ "body": "Would it be good to mention and link to the waiting for author queue? This is just a suggestion, and you can disagree here.\n\n```suggestion\n7. Submit feedback on GitHub and move the ticket into the waiting for author [NAME_REDACTED] flags, \"patch needs improvement\",\n \"needs tests\", and \"needs documentation\", as needed. If you have given a\n```",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T15:42:34+00:00"
+ },
+ {
+ "id": 2746887562,
+ "user": "user_8d47d9546a2c",
+ "body": "I like that the no ticket PRs is being documented here. It makes me think how we can incorporate the list of no ticket PRs into Trac...",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T15:49:26+00:00"
+ },
+ {
+ "id": 2747140464,
+ "user": "user_3a67c55598c5",
+ "body": "Let's remove it; winds are shifting ⛵",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T16:51:39+00:00"
+ },
+ {
+ "id": 2748095503,
+ "user": "user_6b79e26637e6",
+ "body": "I'm going to remove both since combining would leave it as a single sub-bullet.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:49:36+00:00"
+ },
+ {
+ "id": 2748115790,
+ "user": "user_6b79e26637e6",
+ "body": "I added a pair of sub-bullets. Let me know if that helps.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 580,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:54:27+00:00"
+ },
+ {
+ "id": 2748116627,
+ "user": "user_6b79e26637e6",
+ "body": "Fixed.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:54:37+00:00"
+ },
+ {
+ "id": 2748118460,
+ "user": "user_6b79e26637e6",
+ "body": "Added a sentence to clarify it's a list of review types.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:55:02+00:00"
+ },
+ {
+ "id": 2748119089,
+ "user": "user_6b79e26637e6",
+ "body": "Attempted a fix.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:55:10+00:00"
+ },
+ {
+ "id": 2748123831,
+ "user": "user_6b79e26637e6",
+ "body": "I was on the fence about this, but we're already pretty wordy here. I put it as a follow-up sentence since this first sentence should be instructional. I think it should be concise and direct. The rest of the bullet can be informative which is what I'd characterize the waiting on author [NAME_REDACTED]",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:56:16+00:00"
+ },
+ {
+ "id": 2748124742,
+ "user": "user_6b79e26637e6",
+ "body": "Added",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:56:29+00:00"
+ },
+ {
+ "id": 2748125997,
+ "user": "user_6b79e26637e6",
+ "body": "Incorporated.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:56:50+00:00"
+ },
+ {
+ "id": 2748126718,
+ "user": "user_6b79e26637e6",
+ "body": "Added a link.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:57:03+00:00"
+ },
+ {
+ "id": 2748137514,
+ "user": "user_6b79e26637e6",
+ "body": "Rather than changing this particular line, I made the follow-up paragraph to list an admonition to make it stand out. I specifically mentioned reviewing code and triaging tickets, then changed the last sentence to explicitly say we want their help.\n\nAll that said, imposter syndrome is a real thing and we have too much process to convince every person a little effort from them is desirable by us.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 66,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T21:59:46+00:00"
+ },
+ {
+ "id": 2748150765,
+ "user": "user_6b79e26637e6",
+ "body": "The sentiment behind your request is covered in step 4. We could reword it to match one of the metaphors you highlighted.\n\nPersonally, I like the three questions we have in step 4 at the moment. It gives tangible steps to the person on how to proceed forward.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 519,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:03:41+00:00"
+ },
+ {
+ "id": 2748158615,
+ "user": "user_6b79e26637e6",
+ "body": "Yeah, I think we can remove \"Does the change :ref:`adhere to the guidelines for contributing `?\" because we've added \"See :ref:`patch-review-checklist`.\" to step 3 above.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 537,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:05:49+00:00"
+ },
+ {
+ "id": 2748206568,
+ "user": "user_6b79e26637e6",
+ "body": "I've added a new step between this one and the next that asks the reviewer to consider their feedback before submitting it. Thank you for highlighting that.",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:20:32+00:00"
+ },
+ {
+ "id": 2748207123,
+ "user": "user_6b79e26637e6",
+ "body": "Removed",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 537,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:20:42+00:00"
+ },
+ {
+ "id": 2748659162,
+ "user": "user_3a67c55598c5",
+ "body": "Sorry, this bit was just telling you something I remembered from Sarah's talk rather than a suggestion 🙈",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": 519,
+ "side": "RIGHT",
+ "created_at": "2026-01-31T01:38:00+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 2,
+ "COMMENTED": 22
+ },
+ "meaningful_comment_count": 36,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 39
+ }
+}
+{
+ "_id": "a6697940cfd347e9",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.536480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20586,
+ "title": "Fixed #36847 -- Ensured auto_now_add fields are set before FileField.upload_to is called.",
+ "body": "#### Trac ticket number\n\n\n\nticket-36847\n\n#### Branch description\nIn Django 5.2 and earlier, an `auto_now_add=True` `DateTimeField` could be accessed inside a `FileField`’s `upload_to` callable, because the field was populated with the current timestamp during insertion.\nThis is a regression introduced in 94680437a45a71c70ca8bd2e68b72aa1e2eff337 where the insert path called `field.pre_save()` with `add=False` instead of `add=True`. \n\nThis fix restores the correct behavior by [NAME_REDACTED] to `add=True`.\n(Used AI to help create the test coverage for the fix. I have verified that it's working correctly.)\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [ ] **No AI tools were used** in preparing this PR.\n- [x] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_d96dcc7f8ae4",
+ "created_at": "2026-01-25T18:40:29+00:00",
+ "merged_at": "2026-01-29T13:11:33+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36847",
+ "additions": 23,
+ "deletions": 2,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/db/models/base.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -1175,7 +1175,9 @@ def _save_table(\n ].features.can_return_columns_from_insert\n for field in insert_fields:\n value = (\n- getattr(self, field.attname) if raw else field.pre_save(self, False)\n+ getattr(self, field.attname)\n+ if raw\n+ else field.pre_save(self, add=True)\n )\n if hasattr(value, \"resolve_expression\"):\n if field not in returning_fields:"
+ },
+ {
+ "filename": "docs/releases/6.0.2.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -15,3 +15,6 @@ Bugfixes\n to wrap below the changelist when filter elements contained long text\n (:ticket:`36850`).\n \n+* Fixed a regression in Django 6.0 where ``auto_now_add`` field values were not\n+ populated during ``INSERT`` operations, due to incorrect parameters passed to\n+ ``field.pre_save()`` (:ticket:`36847`)."
+ },
+ {
+ "filename": "tests/model_fields/models.py",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 0,
+ "changes": 10,
+ "patch": "@@ -262,10 +262,20 @@ class DataModel(models.Model):\n # FileField\n \n \n+def upload_to_with_date(instance, filename):\n+ return f\"{instance.created_at.year}/{filename}\"\n+\n+\n class Document(models.Model):\n myfile = models.FileField(storage=temp_storage, upload_to=\"unused\", unique=True)\n \n \n+# See ticket #36847.\n+class DocumentWithTimestamp(models.Model):\n+ created_at = models.DateTimeField(auto_now_add=True)\n+ myfile = models.FileField(storage=temp_storage, upload_to=upload_to_with_date)\n+\n+\n ###############################################################################\n # ImageField"
+ },
+ {
+ "filename": "tests/model_fields/test_filefield.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 1,
+ "changes": 8,
+ "patch": "@@ -13,7 +13,7 @@\n from django.test import TestCase, override_settings\n from django.test.utils import isolate_apps\n \n-from .models import Document\n+from .models import Document, DocumentWithTimestamp\n \n \n class FileFieldTests(TestCase):\n@@ -209,3 +209,9 @@ class MyDocument(AbstractMyDocument):\n \n document = MyDocument(myfile=\"test_file.py\")\n self.assertEqual(document.myfile.field.model, MyDocument)\n+\n+ def test_upload_to_callable_sees_auto_now_add_field_value(self):\n+ d = DocumentWithTimestamp(myfile=ContentFile(b\"content\", name=\"foo\"))\n+ d.save()\n+ self.assertIsNotNone(d.created_at)\n+ self.assertIs(d.myfile.name.startswith(f\"{d.created_at.year}/foo\"), True)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3719299168,
+ "user": "user_00dac951cdbf",
+ "state": "APPROVED",
+ "body": "Thank you [USER_REDACTED] for this work! 🌟 \n\nI pushed some edits and will merge when CI is green.",
+ "submitted_at": "2026-01-28T21:40:42+00:00"
+ },
+ {
+ "id": 3719413037,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T22:08:13+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2738823707,
+ "user": "user_3a67c55598c5",
+ "body": "```suggestion\n populated during ``INSERT`` operations, due to incorrect parameters passed to\n```",
+ "path": "docs/releases/6.0.2.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T22:08:14+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "daa290da1120489b",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.537480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20580,
+ "title": "Fixed #36879 -- [NAME_REDACTED] client in Redis client metadata.",
+ "body": "#### Trac ticket number\n\n\n\nticket-36879\n\n#### Branch description\nRedis documentation recommends that clients identify themselves via connection metadata to help operators monitor, debug, and reason about production systems (for example using CLIENT SETINFO / CLIENT INFO).\n\nThis patch allows Django to set its own driver info for redis-py connections, which will be a different `lib-name`:\n\n `redis-py` -> `redis-py(django_v{django_version})`.\n\nThis is achieved by [NAME_REDACTED] `Connection` class to include Django's custom `lib_name` or `driver_info`.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_3e168b76e1d1",
+ "created_at": "2026-01-24T14:27:21+00:00",
+ "merged_at": "2026-02-03T11:40:29+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36879",
+ "additions": 34,
+ "deletions": 1,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "AUTHORS",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -113,6 +113,7 @@ answer newbie questions, and generally made Django that much better:\n [NAME_EMAIL_REDACTED]\n [NAME_EMAIL_REDACTED]\n Anže Pečar <[EMAIL_REDACTED]>\n+ ar3ph \n A. [NAME_EMAIL_REDACTED]\n [NAME_REDACTED]\n arien <[EMAIL_REDACTED]>"
+ },
+ {
+ "filename": "django/core/cache/backends/redis.py",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 1,
+ "changes": 15,
+ "patch": "@@ -4,6 +4,7 @@\n import random\n import re\n \n+import django\n from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache\n from django.utils.functional import cached_property\n from django.utils.module_loading import import_string\n@@ -59,7 +60,19 @@ def __init__(\n parser_class = import_string(parser_class)\n parser_class = parser_class or self._lib.connection.DefaultParser\n \n- self._pool_options = {\"parser_class\": parser_class, **options}\n+ version = django.get_version()\n+ if hasattr(self._lib, \"DriverInfo\"):\n+ driver_info = self._lib.DriverInfo().add_upstream_driver(\"django\", version)\n+ driver_info_options = {\"driver_info\": driver_info}\n+ else:\n+ # DriverInfo is not available in this redis-py version.\n+ driver_info_options = {\"lib_name\": f\"redis-py(django_v{version})\"}\n+\n+ self._pool_options = {\n+ \"parser_class\": parser_class,\n+ **driver_info_options,\n+ **options,\n+ }\n \n def _get_connection_pool_index(self, write):\n # Write to the first server. Read from other servers if there are more,"
+ },
+ {
+ "filename": "tests/cache/tests.py",
+ "status": "modified",
+ "additions": 19,
+ "deletions": 0,
+ "changes": 19,
+ "patch": "@@ -15,6 +15,7 @@\n from pathlib import Path\n from unittest import mock, skipIf\n \n+import django\n from django.conf import settings\n from django.core import management, signals\n from django.core.cache import (\n@@ -1986,6 +1987,24 @@ def test_redis_pool_options(self):\n self.assertEqual(pool.connection_kwargs[\"socket_timeout\"], 0.1)\n self.assertIs(pool.connection_kwargs[\"retry_on_timeout\"], True)\n \n+ def test_client_driver_info(self):\n+ client_info = cache._cache.get_client().client_info()\n+ if {\"lib-name\", \"lib-ver\"}.issubset(client_info):\n+ version = django.get_version()\n+ if hasattr(self.lib, \"DriverInfo\"):\n+ info = self._lib.DriverInfo().add_upstream_driver(\"django\", version)\n+ correct_lib_name = info.formatted_name\n+ else:\n+ correct_lib_name = f\"redis-py(django_v{version})\"\n+ # Relax the assertion to allow date variance in editable installs.\n+ truncated_lib_name = correct_lib_name.rsplit(\".dev\", maxsplit=1)[0]\n+ self.assertIn(truncated_lib_name, client_info[\"lib-name\"])\n+ self.assertEqual(client_info[\"lib-ver\"], self.lib.__version__)\n+ else:\n+ # Redis versions below 7.2 lack CLIENT SETINFO.\n+ self.assertNotIn(\"lib-ver\", client_info)\n+ self.assertNotIn(\"lib-name\", client_info)\n+\n \n class FileBasedCachePathLibTests(FileBasedCacheTests):\n def mkdtemp(self):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3705951654,
+ "user": "user_7c777599a482",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-26T13:04:24+00:00"
+ },
+ {
+ "id": 3713634439,
+ "user": "user_3e168b76e1d1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-27T21:54:33+00:00"
+ },
+ {
+ "id": 3716400655,
+ "user": "user_7c777599a482",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T12:15:12+00:00"
+ },
+ {
+ "id": 3719143566,
+ "user": "user_3e168b76e1d1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T21:03:28+00:00"
+ },
+ {
+ "id": 3729908342,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks, I have some initial questions for you.",
+ "submitted_at": "2026-01-30T19:03:48+00:00"
+ },
+ {
+ "id": 3729932112,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T19:05:55+00:00"
+ },
+ {
+ "id": 3730690648,
+ "user": "user_3e168b76e1d1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:25:10+00:00"
+ },
+ {
+ "id": 3730708348,
+ "user": "user_3e168b76e1d1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T22:29:36+00:00"
+ },
+ {
+ "id": 3735081102,
+ "user": "user_3e168b76e1d1",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-01T06:40:21+00:00"
+ },
+ {
+ "id": 3741213030,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Looks good, thank you ⭐ \n\nI pushed cosmetic edits and relaxed the assertion to avoid headaches I've seen when editable installs have dates timestamped into the version number.",
+ "submitted_at": "2026-02-02T18:30:03+00:00"
+ },
+ {
+ "id": 3744002448,
+ "user": "user_7c777599a482",
+ "state": "APPROVED",
+ "body": "Looks good, thank you [USER_REDACTED] and [USER_REDACTED] !",
+ "submitted_at": "2026-02-03T09:06:55+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2727532891,
+ "user": "user_7c777599a482",
+ "body": "Let's also verify that `lib-version` is properly set to the `redis-py` version.",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-26T13:04:24+00:00"
+ },
+ {
+ "id": 2733976773,
+ "user": "user_3e168b76e1d1",
+ "body": "Is that really necessary? This feels like testing `redis-py` itself.",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-27T21:54:32+00:00"
+ },
+ {
+ "id": 2736368412,
+ "user": "user_7c777599a482",
+ "body": "The point of the test would be to verify that `Django` does not override `lib-ver` to something other than what `redis-py` sets as its own version (unlike what's done with `lib_name`):\n```\n else:\n # DriverInfo is not available in this redis-py version\n self.lib_name = f\"redis-py(django_v{django.get_version()})\"\n```",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T12:15:12+00:00"
+ },
+ {
+ "id": 2738600530,
+ "user": "user_3e168b76e1d1",
+ "body": "i agree.",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T21:03:28+00:00"
+ },
+ {
+ "id": 2747577963,
+ "user": "user_3a67c55598c5",
+ "body": "You can either chop this or replace preambles (\"test that\") with something more descriptive.",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T19:00:47+00:00"
+ },
+ {
+ "id": 2747584391,
+ "user": "user_3a67c55598c5",
+ "body": "What alternatives did you explore besides doing dynamic class creation?",
+ "path": "django/core/cache/backends/redis.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T19:02:08+00:00"
+ },
+ {
+ "id": 2747585280,
+ "user": "user_3a67c55598c5",
+ "body": "Please avoid this quick line break.",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T19:02:19+00:00"
+ },
+ {
+ "id": 2747598668,
+ "user": "user_3a67c55598c5",
+ "body": "Sorry, you can avoid polishing this, I might ask you to remove this note entirely. Not certain yet 🤔",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T19:05:55+00:00"
+ },
+ {
+ "id": 2748219813,
+ "user": "user_3e168b76e1d1",
+ "body": "chopped",
+ "path": "tests/cache/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:25:09+00:00"
+ },
+ {
+ "id": 2748234284,
+ "user": "user_3e168b76e1d1",
+ "body": "None. However, I've found a better alternative now, only updating `self._pool_options`. \n\nB/c extra `pool_options` will eventually be passed to the `ConnectionPool` class's `__init__` method by `from_url` as part of `connection_kwargs`, which will change the driver info.",
+ "path": "django/core/cache/backends/redis.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T22:29:36+00:00"
+ },
+ {
+ "id": 2750635097,
+ "user": "user_3e168b76e1d1",
+ "body": "I think this note should be removed. It's a bit too obscure.",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-01T06:40:21+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 9,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 9,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 11
+ }
+}
+{
+ "_id": "06930afeed3d9e57",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.540481+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20576,
+ "title": "Fixed #36788 -- Fixed horizontal form field alignment under in the admin.",
+ "body": "#### Trac ticket number\nticket-36788\n\n#### Branch description\nSee demo below.\nRegression in 4187da258fe212d494cb578a0bc2b52c4979ab95.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.\n\n#### Demo\n#### Before\n \n\n#### After\n ",
+ "author": "user_3a67c55598c5",
+ "created_at": "2026-01-23T20:12:03+00:00",
+ "merged_at": "2026-02-02T13:15:13+00:00",
+ "base_branch": "main",
+ "head_branch": "jtw/fieldset-horizontal",
+ "additions": 43,
+ "deletions": 4,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/contrib/admin/static/admin/css/forms.css",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 2,
+ "changes": 5,
+ "patch": "@@ -30,7 +30,8 @@ form .form-row p {\n flex-wrap: wrap;\n }\n \n-.form-multiline > div {\n+.form-multiline > div,\n+.form-multiline > fieldset {\n padding-bottom: 10px;\n }\n \n@@ -93,7 +94,7 @@ fieldset .inline-heading,\n /* ALIGNED FIELDSETS */\n \n .aligned fieldset {\n- width: 100%;\n+ flex-grow: 1;\n border-top: none;\n }"
+ },
+ {
+ "filename": "docs/releases/6.0.2.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -15,6 +15,9 @@ Bugfixes\n to wrap below the changelist when filter elements contained long text\n (:ticket:`36850`).\n \n+* Fixed a visual regression in Django 6.0 for admin form fields grouped under a\n+ ```` aligned horizontally (:ticket:`36788`).\n+\n * Fixed a regression in Django 6.0 where ``auto_now_add`` field values were not\n populated during ``INSERT`` operations, due to incorrect parameters passed to\n ``field.pre_save()`` (:ticket:`36847`)."
+ },
+ {
+ "filename": "tests/admin_views/admin.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 0,
+ "changes": 12,
+ "patch": "@@ -1198,6 +1198,18 @@ class CamelCaseAdmin(admin.ModelAdmin):\n \n class CourseAdmin(admin.ModelAdmin):\n radio_fields = {\"difficulty\": admin.VERTICAL}\n+ fieldsets = (\n+ (\n+ None,\n+ {\n+ \"fields\": (\n+ (\"title\", \"difficulty\"),\n+ (\"materials\", \"start_datetime\"),\n+ (\"categories\"),\n+ ),\n+ },\n+ ),\n+ )\n \n \n site = admin.AdminSite(name=\"admin\")"
+ },
+ {
+ "filename": "tests/admin_views/tests.py",
+ "status": "modified",
+ "additions": 25,
+ "deletions": 2,
+ "changes": 27,
+ "patch": "@@ -7065,10 +7065,10 @@ def test_use_fieldset_fields_render(self):\n title=\"[NAME_REDACTED]\", materials=\"django_documents\"\n )\n expected_legend_tags_text = [\n- \"Materials:\",\n \"Difficulty:\",\n- \"Categories:\",\n+ \"Materials:\",\n \"Start datetime:\",\n+ \"Categories:\",\n ]\n url = reverse(\"admin:admin_views_course_change\", args=(course.pk,))\n self.selenium.get(self.live_server_url + url)\n@@ -7079,6 +7079,29 @@ def test_use_fieldset_fields_render(self):\n legend = fieldset.find_element(By.TAG_NAME, \"legend\")\n self.assertEqual(legend.text, expected_legend_tags_text[index])\n \n+ [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n+ def test_use_fieldset_with_grouped_fields(self):\n+ from selenium.webdriver.common.by [NAME_REDACTED]\n+\n+ self.admin_login(\n+ username=\"super\", password=\"secret\", login_url=reverse(\"admin:index\")\n+ )\n+ self.selenium.get(\n+ self.live_server_url + reverse(\"admin:admin_views_course_add\")\n+ )\n+ multiline = self.selenium.find_element(\n+ By.CSS_SELECTOR, \"#content-main .field-difficulty, .form-multiline\"\n+ )\n+ # Two field boxes.\n+ field_boxes = multiline.find_elements(By.CSS_SELECTOR, \"div > div.fieldBox\")\n+ self.assertEqual(len(field_boxes), 2)\n+ # One of them is under a .\n+ under_fieldset = multiline.find_elements(\n+ By.CSS_SELECTOR, \"fieldset > div > div.fieldBox\"\n+ )\n+ self.assertEqual(len(under_fieldset), 1)\n+ self.take_screenshot(\"horizontal_fieldset\")\n+\n [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n [USER_REDACTED]_settings(MESSAGE_LEVEL=10)\n def test_messages(self):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3700386594,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": "[NAME_REDACTED] are a lot of regressions happening with this work 😢\nAdditionally, I found one `CSS` thing that should have been done before.\n```diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css\nindex e3b7d58857..6294f368b6 100644\n--- a/django/contrib/admin/static/admin/css/forms.css\n+++ b/django/contrib/admin/static/admin/css/forms.css\n@@ -30,7 +30,8 @@ form .form-row p {\n flex-wrap: wrap;\n }\n \n-.form-multiline > div {\n+.form-multiline > div,\n+.form-multiline > fieldset {\n padding-bottom: 10px;\n }\n```\n\n## Before\n\n \n\n## After\n\n \n\nShould this be added to this PR? or would it be better to separate it?",
+ "submitted_at": "2026-01-24T02:07:47+00:00"
+ },
+ {
+ "id": 3700577913,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-24T04:02:36+00:00"
+ },
+ {
+ "id": 3701494607,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-24T12:18:11+00:00"
+ },
+ {
+ "id": 3738206318,
+ "user": "user_45c2e5489720",
+ "state": "APPROVED",
+ "body": "Thank you ! It looks good to me 👍",
+ "submitted_at": "2026-02-02T09:20:36+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2723411328,
+ "user": "user_45c2e5489720",
+ "body": "It seems like the existing tests are failing(`admin_views.tests.SeleniumTests.test_populate_existing_object`) due to changing the field type. \nOf course, we could fix the tests, but instead of changing the field type, what do you think about using the `Course` model that was previously created for the fieldsets tests?\nI think we would just need to add `fieldsets` to the `ModelAdmin`.\n\nhttps://github.com/[USER_REDACTED]ngo/django/blob/68d110f1fe593b7a368486c41cd062563a74fe0a/tests/admin_views/models.py#L626-L639",
+ "path": "tests/admin_views/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T01:46:50+00:00"
+ },
+ {
+ "id": 2723428257,
+ "user": "user_45c2e5489720",
+ "body": "What do you think about including something that conveys \"multiple fields\"? 🤔 I think it would be a bit clearer (like the \"multiline\" being added in CSS).",
+ "path": "tests/admin_views/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T02:07:31+00:00"
+ },
+ {
+ "id": 2723572133,
+ "user": "user_3a67c55598c5",
+ "body": "Sure thing. I was taking a shortcut and figured I'd hear a better idea :)",
+ "path": "tests/admin_views/models.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T04:02:36+00:00"
+ },
+ {
+ "id": 2724089473,
+ "user": "user_45c2e5489720",
+ "body": "I think we should verify that the multiline container contains fieldset tags and at least 2 fields before taking the screenshot :)\n```diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py\nindex 8ac5571f9d..8290c56138 100644\n--- a/tests/admin_views/tests.py\n+++ b/tests/admin_views/tests.py\n@@ -7081,12 +7081,23 @@ class SeleniumTests(AdminSeleniumTestCase):\n \n [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n def test_use_fieldset_fields_horizontal(self):\n+ from selenium.webdriver.common.by [NAME_REDACTED]\n+\n self.admin_login(\n username=\"super\", password=\"secret\", login_url=reverse(\"admin:index\")\n )\n self.selenium.get(\n self.live_server_url + reverse(\"admin:admin_views_mainprepopulated_add\")\n )\n+ multiline = self.selenium.find_element(\n+ By.CSS_SELECTOR, \"#content-main .field-pubdate .form-multiline\",\n+ )\n+ # Get direct children (div, fieldset) of multiline\n+ divs = multiline.find_elements(By.CSS_SELECTOR, \":scope > div\")\n+ fieldsets = multiline.find_elements(By.CSS_SELECTOR, \":scope > fieldset\")\n+ fields = divs + fieldsets\n+ self.assertGreater(len(fields), 1)\n+ self.assertGreater(len(fieldsets), 0)\n self.take_screenshot(\"horizontal_fieldset\")\n \n [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n```\nI'm not sure if using `:scope` is the best approach here 🥲",
+ "path": "tests/admin_views/tests.py",
+ "line": 7103,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T12:18:11+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "css",
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "d62274b4c7f0aaed",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.542480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20574,
+ "title": "Fixed #36878 -- Unified data type for *_together options in ModelState.",
+ "body": "Ever since the beginning of Django's migration framework, there's been a bit of an inconsistency on how index_together and unique_together values have been stored on the ModelState[^1].\n\nIt's only really obvious, when looking at the current code for `from_model()`[^2] and the `rename_field()` state alteration code[^3].\n\nThe problem in the autodetector's detection of the `*_together` options as raised in the ticket, reinforces the inconsistency[^4]: the old value is being normalized to a set of tuples, whereas the new value is taken as-is.\n\nWhy this hasn't been caught before, is likely to the fact, that we never really look at a `to_state` that comes from migration operations in the autodetector. Instead, in both usages in Django[^5], [^6] the `to_state` is a `ProjectState.from_apps()`. And that state is consistently using sets of tuples and not lists of lists.\n\n[^1]: https://github.com/[USER_REDACTED]ngo/django/commit/67dcea711e92025d0e8676b869b7ef15dbc6db73#diff-5dd147e9e978e645313dd99eab3a7bab1f1cb0a53e256843adb68aeed71e61dcR85-R87\n[^2]: https://github.com/[USER_REDACTED]ngo/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/state.py#L842\n[^3]: https://github.com/[USER_REDACTED]ngo/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/state.py#L340-L345\n[^4]: https://github.com/[USER_REDACTED]ngo/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/autodetector.py#L1757-L1771\n[^5]: https://github.com/[USER_REDACTED]ngo/django/blob/2351c1b12cc9cf82d642f769c774bc3ea0cc4006/django/core/management/commands/makemigrations.py#L215-L219\n[^6]: https://github.com/[USER_REDACTED]ngo/django/blob/2351c1b12cc9cf82d642f769c774bc3ea0cc4006/django/core/management/commands/migrate.py#L329-L332\n\n#### Trac ticket number\n\n\n\nticket-36878\n\n#### Branch description\nProvide a concise overview of the issue or rationale behind the proposed changes.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_081d78d226d7",
+ "created_at": "2026-01-23T15:23:51+00:00",
+ "merged_at": "2026-01-28T21:13:05+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-project-state-together-modelstate-mutation",
+ "additions": 69,
+ "deletions": 17,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/db/migrations/state.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 6,
+ "changes": 13,
+ "patch": "@@ -192,9 +192,10 @@ def alter_model_options(self, app_label, model_name, options, option_keys=None):\n def remove_model_options(self, app_label, model_name, option_name, value_to_remove):\n model_state = self.models[app_label, model_name]\n if objs := model_state.options.get(option_name):\n- model_state.options[option_name] = [\n- obj for obj in objs if tuple(obj) != tuple(value_to_remove)\n- ]\n+ new_value = [obj for obj in objs if tuple(obj) != tuple(value_to_remove)]\n+ if option_name in {\"index_together\", \"unique_together\"}:\n+ new_value = set(normalize_together(new_value))\n+ model_state.options[option_name] = new_value\n self.reload_model(app_label, model_name, delay=True)\n \n def alter_model_managers(self, app_label, model_name, managers):\n@@ -339,10 +340,10 @@ def rename_field(self, app_label, model_name, old_name, new_name):\n options = model_state.options\n for option in (\"index_together\", \"unique_together\"):\n if option in options:\n- options[option] = [\n- [new_name if n == old_name else n for n in together]\n+ options[option] = {\n+ tuple(new_name if n == old_name else n for n in together)\n for together in options[option]\n- ]\n+ }\n # Fix to_fields to refer to the new field.\n delay = True\n references = get_references(self, model_key, (old_name, found))"
+ },
+ {
+ "filename": "tests/migrations/test_autodetector.py",
+ "status": "modified",
+ "additions": 45,
+ "deletions": 0,
+ "changes": 45,
+ "patch": "@@ -5590,6 +5590,51 @@ def test_remove_composite_pk(self):\n preserve_default=True,\n )\n \n+ def test_does_not_crash_after_rename_on_unique_together(self):\n+ fields = (\"first\", \"second\")\n+ before = self.make_project_state(\n+ [\n+ ModelState(\n+ \"app\",\n+ \"Foo\",\n+ [\n+ (\"id\", models.AutoField(primary_key=True)),\n+ (\"first\", models.IntegerField()),\n+ (\"second\", models.IntegerField()),\n+ ],\n+ options={\"unique_together\": {fields}},\n+ ),\n+ ]\n+ )\n+ after = before.clone()\n+ after.rename_field(\"app\", \"foo\", \"first\", \"first_renamed\")\n+\n+ changes = MigrationAutodetector(\n+ before, after, MigrationQuestioner({\"ask_rename\": True})\n+ )._detect_changes()\n+\n+ self.assertNumberMigrations(changes, \"app\", 1)\n+ self.assertOperationTypes(\n+ changes, \"app\", 0, [\"RenameField\", \"AlterUniqueTogether\"]\n+ )\n+ self.assertOperationAttributes(\n+ changes,\n+ \"app\",\n+ 0,\n+ 0,\n+ model_name=\"foo\",\n+ old_name=\"first\",\n+ new_name=\"first_renamed\",\n+ )\n+ self.assertOperationAttributes(\n+ changes,\n+ \"app\",\n+ 0,\n+ 1,\n+ name=\"foo\",\n+ unique_together={(\"first_renamed\", \"second\")},\n+ )\n+\n \n class MigrationSuggestNameTests(SimpleTestCase):\n def test_no_operations(self):"
+ },
+ {
+ "filename": "tests/migrations/test_base.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 4,
+ "changes": 7,
+ "patch": "@@ -290,14 +290,13 @@ def set_up_test_model(\n ):\n \"\"\"Creates a test model state and database table.\"\"\"\n # Make the \"current\" state.\n- model_options = {\n- \"swappable\": \"TEST_SWAP_MODEL\",\n- \"unique_together\": [[\"pink\", \"weight\"]] if unique_together else [],\n- }\n+ model_options = {\"swappable\": \"TEST_SWAP_MODEL\"}\n if options:\n model_options[\"permissions\"] = [(\"can_groom\", \"Can groom\")]\n if db_table:\n model_options[\"db_table\"] = db_table\n+ if unique_together:\n+ model_options[\"unique_together\"] = {(\"pink\", \"weight\")}\n operations = [\n migrations.CreateModel(\n \"Pony\","
+ },
+ {
+ "filename": "tests/migrations/test_operations.py",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 7,
+ "changes": 21,
+ "patch": "@@ -3336,11 +3336,11 @@ def test_rename_field_unique_together(self):\n # unique_together has the renamed column.\n self.assertIn(\n \"blue\",\n- new_state.models[\"test_rnflut\", \"pony\"].options[\"unique_together\"][0],\n+ list(new_state.models[\"test_rnflut\", \"pony\"].options[\"unique_together\"])[0],\n )\n self.assertNotIn(\n \"pink\",\n- new_state.models[\"test_rnflut\", \"pony\"].options[\"unique_together\"][0],\n+ list(new_state.models[\"test_rnflut\", \"pony\"].options[\"unique_together\"])[0],\n )\n # Rename field.\n self.assertColumnExists(\"test_rnflut_pony\", \"pink\")\n@@ -3377,7 +3377,7 @@ def test_rename_field_index_together(self):\n (\"weight\", models.FloatField()),\n ],\n options={\n- \"index_together\": [(\"weight\", \"pink\")],\n+ \"index_together\": {(\"weight\", \"pink\")},\n },\n ),\n ]\n@@ -3390,10 +3390,12 @@ def test_rename_field_index_together(self):\n self.assertNotIn(\"pink\", new_state.models[\"test_rnflit\", \"pony\"].fields)\n # index_together has the renamed column.\n self.assertIn(\n- \"blue\", new_state.models[\"test_rnflit\", \"pony\"].options[\"index_together\"][0]\n+ \"blue\",\n+ list(new_state.models[\"test_rnflit\", \"pony\"].options[\"index_together\"])[0],\n )\n self.assertNotIn(\n- \"pink\", new_state.models[\"test_rnflit\", \"pony\"].options[\"index_together\"][0]\n+ \"pink\",\n+ list(new_state.models[\"test_rnflit\", \"pony\"].options[\"index_together\"])[0],\n )\n \n # Rename field.\n@@ -3952,7 +3954,7 @@ def test_rename_index_unnamed_index(self):\n (\"weight\", models.FloatField()),\n ],\n options={\n- \"index_together\": [(\"weight\", \"pink\")],\n+ \"index_together\": {(\"weight\", \"pink\")},\n },\n ),\n ]\n@@ -3972,6 +3974,11 @@ def test_rename_index_unnamed_index(self):\n )\n new_state = project_state.clone()\n operation.state_forwards(app_label, new_state)\n+ # Ensure the model state has the correct type for the index_together\n+ # option.\n+ self.assertIsInstance(\n+ new_state.models[app_label, \"pony\"].options[\"index_together\"], set\n+ )\n # Rename index.\n with connection.schema_editor() as editor:\n operation.database_forwards(app_label, editor, project_state, new_state)\n@@ -4079,7 +4086,7 @@ def test_rename_index_state_forwards_unnamed_index(self):\n (\"weight\", models.FloatField()),\n ],\n options={\n- \"index_together\": [(\"weight\", \"pink\")],\n+ \"index_together\": {(\"weight\", \"pink\")},\n },\n ),\n ]"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3698133887,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-23T15:30:31+00:00"
+ },
+ {
+ "id": 3698135714,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-23T15:30:51+00:00"
+ },
+ {
+ "id": 3698136133,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-23T15:30:57+00:00"
+ },
+ {
+ "id": 3698225072,
+ "user": "user_057de2f3b132",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-23T15:47:24+00:00"
+ },
+ {
+ "id": 3717148345,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T14:53:53+00:00"
+ },
+ {
+ "id": 3717150377,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED]!",
+ "submitted_at": "2026-01-28T14:55:06+00:00"
+ },
+ {
+ "id": 3717207416,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T15:04:51+00:00"
+ },
+ {
+ "id": 3717308560,
+ "user": "user_081d78d226d7",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T15:21:10+00:00"
+ },
+ {
+ "id": 3717344857,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "🚀",
+ "submitted_at": "2026-01-28T15:26:16+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2721704994,
+ "user": "user_081d78d226d7",
+ "body": "I haven't been able to come up with a test triggering the same problem as reported, but there is a type inconsistency here.",
+ "path": "django/db/migrations/state.py",
+ "line": 195,
+ "side": "RIGHT",
+ "created_at": "2026-01-23T15:30:31+00:00"
+ },
+ {
+ "id": 2721706428,
+ "user": "user_081d78d226d7",
+ "body": "```suggestion\n options[option] = {\n```",
+ "path": "django/db/migrations/state.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-23T15:30:51+00:00"
+ },
+ {
+ "id": 2721706779,
+ "user": "user_081d78d226d7",
+ "body": "```suggestion\n }\n```",
+ "path": "django/db/migrations/state.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-23T15:30:57+00:00"
+ },
+ {
+ "id": 2737017476,
+ "user": "user_3a67c55598c5",
+ "body": "I added some minimal coverage like this:\n```diff\ndiff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py\nindex 28d65a7ecf..d3a2f732f2 100644\n--- a/tests/migrations/test_operations.py\n+++ b/tests/migrations/test_operations.py\n@@ -3974,6 +3974,7 @@ class OperationTests(OperationTestBase):\n )\n new_state = project_state.clone()\n operation.state_forwards(app_label, new_state)\n+ self.assertIsInstance(new_state.models[app_label, \"pony\"].options[\"index_together\"], set)\n # Rename index.\n with connection.schema_editor() as editor:\n operation.database_forwards(app_label, editor, project_state, new_state)\n```\n\nUnless you think that's testing an implementation detail? Poking around, we have other assertions against `new_state.models`.",
+ "path": "django/db/migrations/state.py",
+ "line": 195,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T14:53:53+00:00"
+ },
+ {
+ "id": 2737019284,
+ "user": "user_3a67c55598c5",
+ "body": "You can chop, we just leave ticket references in the blame these days.",
+ "path": "tests/migrations/test_autodetector.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T14:54:19+00:00"
+ },
+ {
+ "id": 2737068892,
+ "user": "user_3a67c55598c5",
+ "body": "If this assertion feels like a non sequitur, we could pull it out into a new test method.",
+ "path": "django/db/migrations/state.py",
+ "line": 195,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:04:51+00:00"
+ },
+ {
+ "id": 2737153176,
+ "user": "user_081d78d226d7",
+ "body": "That's great. Thank you!",
+ "path": "django/db/migrations/state.py",
+ "line": 195,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:21:10+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 7,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 7,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 7
+ }
+}
+{
+ "_id": "4177802d17741f15",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20538,
+ "title": "Fixed #36865 -- Removed casting from exact lookups in admin searches.",
+ "body": "Fixes https://code.djangoproject.com/ticket/36865\n\n## [NAME_REDACTED] PR fixes a performance regression introduced in PR #17885.\n\nThe `Cast` to `CharField` for non-string field exact lookups prevents database index usage on primary key fields, generating SQL like:\n\n```sql\nWHERE (\"table\".\"id\")::varchar = '123'\n```\n\nThis cannot use the primary key index and causes full table scans, resulting in timeouts on large tables (reported in [ticket #26001 comment 24](https://code.djangoproject.com/ticket/26001#comment:24)), and discovered in a project I work on at https://github.com/freelawproject/courtlistener/issues/6790.\n\n## [NAME_REDACTED] the casting approach introduced in #17885, and replace it with field validation that uses `to_python` on the results of `smart_split` to ensure that we only apply field-term pairs that make sense. For example: \n\n - searching a PrimaryKey field for \"foo\" --> Nope!\n - searching a TextField for \"foo\" --> Yes!\n - searching a TextField for \"123\" --> Close enough. Yes!\n\nAnd so forth. \n\nThis should ensure DB indexes are used and that we don't send nonsensical queries in the first place. \n\n## Trac tickets\n\nIntroducing issue: https://code.djangoproject.com/ticket/26001\nSolving it: https://code.djangoproject.com/ticket/36865",
+ "author": "user_c010523698ce",
+ "created_at": "2026-01-15T00:35:58+00:00",
+ "merged_at": "2026-01-30T16:45:39+00:00",
+ "base_branch": "main",
+ "head_branch": "fix-admin-search-cast-performance",
+ "additions": 128,
+ "deletions": 26,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "django/contrib/admin/options.py",
+ "status": "modified",
+ "additions": 37,
+ "deletions": 26,
+ "changes": 63,
+ "patch": "@@ -41,7 +41,6 @@\n from django.core.paginator import Paginator\n from django.db import models, router, transaction\n from django.db.models.constants import LOOKUP_SEP\n-from django.db.models.functions import Cast\n from django.forms.formsets import DELETION_FIELD_NAME, all_valid\n from django.forms.models import (\n BaseInlineFormSet,\n@@ -1137,6 +1136,12 @@ def get_search_results(self, request, queryset, search_term):\n \n # Apply keyword searches.\n def construct_search(field_name):\n+ \"\"\"\n+ Return a tuple of (lookup, field_to_validate).\n+\n+ field_to_validate is set for non-text exact lookups so that\n+ invalid search terms can be skipped (preserving index usage).\n+ \"\"\"\n if field_name.startswith(\"^\"):\n return \"%s__istartswith\" % field_name.removeprefix(\"^\"), None\n elif field_name.startswith(\"=\"):\n@@ -1148,7 +1153,7 @@ def construct_search(field_name):\n lookup_fields = field_name.split(LOOKUP_SEP)\n # Go through the fields, following all relations.\n prev_field = None\n- for i, path_part in enumerate(lookup_fields):\n+ for path_part in lookup_fields:\n if path_part == \"pk\":\n path_part = opts.pk.name\n try:\n@@ -1159,15 +1164,9 @@ def construct_search(field_name):\n if path_part == \"exact\" and not isinstance(\n prev_field, (models.CharField, models.TextField)\n ):\n- field_name_without_exact = \"__\".join(lookup_fields[:i])\n- alias = Cast(\n- field_name_without_exact,\n- output_field=models.CharField(),\n- )\n- alias_name = \"_\".join(lookup_fields[:i])\n- return f\"{alias_name}_str\", alias\n- else:\n- return field_name, None\n+ # Use prev_field to validate the search term.\n+ return field_name, prev_field\n+ return field_name, None\n else:\n prev_field = field\n if hasattr(field, \"path_infos\"):\n@@ -1179,30 +1178,42 @@ def construct_search(field_name):\n may_have_duplicates = False\n search_fields = self.get_search_fields(request)\n if search_fields and search_term:\n- str_aliases = {}\n orm_lookups = []\n for field in search_fields:\n- lookup, str_alias = construct_search(str(field))\n- orm_lookups.append(lookup)\n- if str_alias:\n- str_aliases[lookup] = str_alias\n-\n- if str_aliases:\n- queryset = queryset.alias(**str_aliases)\n+ orm_lookups.append(construct_search(str(field)))\n \n term_queries = []\n for bit in smart_split(search_term):\n if bit.startswith(('\"', \"'\")) and bit[0] == bit[-1]:\n bit = unescape_string_literal(bit)\n- or_queries = models.Q.create(\n- [(orm_lookup, bit) for orm_lookup in orm_lookups],\n- connector=models.Q.OR,\n- )\n- term_queries.append(or_queries)\n- queryset = queryset.filter(models.Q.create(term_queries))\n+ # Build term lookups, skipping values invalid for their field.\n+ bit_lookups = []\n+ for orm_lookup, validate_field in orm_lookups:\n+ if validate_field is not None:\n+ formfield = validate_field.formfield()\n+ try:\n+ if formfield is not None:\n+ value = formfield.to_python(bit)\n+ else:\n+ # Fields like AutoField lack a form field.\n+ value = validate_field.to_python(bit)\n+ except ValidationError:\n+ # Skip this lookup for invalid values.\n+ continue\n+ else:\n+ value = bit\n+ bit_lookups.append((orm_lookup, value))\n+ if bit_lookups:\n+ or_queries = models.Q.create(bit_lookups, connector=models.Q.OR)\n+ term_queries.append(or_queries)\n+ else:\n+ # No valid lookups: add a filter that returns nothing.\n+ term_queries.append(models.Q(pk__in=[]))\n+ if term_queries:\n+ queryset = queryset.filter(models.Q.create(term_queries))\n may_have_duplicates |= any(\n lookup_spawns_duplicates(self.opts, search_spec)\n- for search_spec in orm_lookups\n+ for search_spec, _ in orm_lookups\n )\n return queryset, may_have_duplicates"
+ },
+ {
+ "filename": "tests/admin_changelist/models.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 0,
+ "changes": 7,
+ "patch": "@@ -140,3 +140,10 @@ class CharPK(models.Model):\n class ProxyUser(User):\n class Meta:\n proxy = True\n+\n+\n+class MixedFieldsModel(models.Model):\n+ \"\"\"Model with multiple field types for testing search validation.\"\"\"\n+\n+ int_field = models.IntegerField(null=True, blank=True)\n+ json_field = models.JSONField(null=True, blank=True)"
+ },
+ {
+ "filename": "tests/admin_changelist/tests.py",
+ "status": "modified",
+ "additions": 84,
+ "deletions": 0,
+ "changes": 84,
+ "patch": "@@ -66,6 +66,7 @@\n Group,\n Invitation,\n Membership,\n+ MixedFieldsModel,\n Musician,\n OrderedObject,\n Parent,\n@@ -856,6 +857,89 @@ def test_custom_lookup_with_pk_shortcut(self):\n cl = m.get_changelist_instance(request)\n self.assertCountEqual(cl.queryset, [abcd])\n \n+ def test_exact_lookup_with_invalid_value(self):\n+ Child.objects.create(name=\"Test\", age=10)\n+ m = admin.ModelAdmin(Child, custom_site)\n+ m.search_fields = [\"pk__exact\"]\n+\n+ request = self.factory.get(\"/\", data={SEARCH_VAR: \"foo\"})\n+ request.user = self.superuser\n+\n+ # Invalid values are gracefully ignored.\n+ cl = m.get_changelist_instance(request)\n+ self.assertCountEqual(cl.queryset, [])\n+\n+ def test_exact_lookup_mixed_terms(self):\n+ \"\"\"\n+ Multi-term search validates each term independently.\n+\n+ For 'foo 123' with search_fields=['name__icontains', 'age__exact']:\n+ - 'foo': age lookup skipped (invalid), name lookup used\n+ - '123': both lookups used (valid for age)\n+ [NAME_REDACTED] should be used; invalid lookups are simply skipped.\n+ \"\"\"\n+ child = Child.objects.create(name=\"foo123\", age=123)\n+ Child.objects.create(name=\"other\", age=456)\n+ m = admin.ModelAdmin(Child, custom_site)\n+ m.search_fields = [\"name__icontains\", \"age__exact\"]\n+\n+ request = self.factory.get(\"/\", data={SEARCH_VAR: \"foo 123\"})\n+ request.user = self.superuser\n+\n+ # One result matching on foo and 123.\n+ cl = m.get_changelist_instance(request)\n+ self.assertCountEqual(cl.queryset, [child])\n+\n+ # \"xyz\" - invalid for age (skipped), no match for name either.\n+ request = self.factory.get(\"/\", data={SEARCH_VAR: \"xyz\"})\n+ request.user = self.superuser\n+ cl = m.get_changelist_instance(request)\n+ self.assertCountEqual(cl.queryset, [])\n+\n+ def test_exact_lookup_with_more_lenient_formfield(self):\n+ \"\"\"\n+ Exact lookups on BooleanField use formfield().to_python() for lenient\n+ parsing. Using model field's to_python() would reject 'false' whereas\n+ the form field accepts it.\n+ \"\"\"\n+ obj = UnorderedObject.objects.create(bool=False)\n+ UnorderedObject.objects.create(bool=True)\n+ m = admin.ModelAdmin(UnorderedObject, custom_site)\n+ m.search_fields = [\"bool__exact\"]\n+\n+ # 'false' is accepted by [NAME_REDACTED] by [NAME_REDACTED]\n+ request = self.factory.get(\"/\", data={SEARCH_VAR: \"false\"})\n+ request.user = self.superuser\n+\n+ cl = m.get_changelist_instance(request)\n+ self.assertCountEqual(cl.queryset, [obj])\n+\n+ def test_exact_lookup_validates_each_field_independently(self):\n+ \"\"\"\n+ Each field validates the search term independently without leaking\n+ converted values between fields.\n+\n+ \"3.\" is valid for IntegerField (converts to 3) but invalid for\n+ JSONField. The converted value must not leak to the JSONField check.\n+ \"\"\"\n+ # obj_int has int_field=3, should match \"3.\" via IntegerField.\n+ obj_int = MixedFieldsModel.objects.create(\n+ int_field=3, json_field={\"key\": \"value\"}\n+ )\n+ # obj_json has json_field=3, should NOT match \"3.\" because \"3.\" is\n+ # invalid JSON.\n+ MixedFieldsModel.objects.create(int_field=99, json_field=3)\n+ m = admin.ModelAdmin(MixedFieldsModel, custom_site)\n+ m.search_fields = [\"int_field__exact\", \"json_field__exact\"]\n+\n+ # \"3.\" is valid for int (becomes 3) but invalid JSON.\n+ # Only obj_int should match via int_field.\n+ request = self.factory.get(\"/\", data={SEARCH_VAR: \"3.\"})\n+ request.user = self.superuser\n+\n+ cl = m.get_changelist_instance(request)\n+ self.assertCountEqual(cl.queryset, [obj_int])\n+\n def test_search_with_exact_lookup_for_non_string_field(self):\n child = Child.objects.create(name=\"Asher\", age=11)\n model_admin = ChildAdmin(Child, custom_site)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3663429620,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": "We'll want a dedicated ticket for that and likely a solution that isn't specific to whether a not a search field is a primary as casting to text is harmful in a lot of other cases.",
+ "submitted_at": "2026-01-15T00:49:03+00:00"
+ },
+ {
+ "id": 3663452979,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T00:57:41+00:00"
+ },
+ {
+ "id": 3663491293,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T01:19:16+00:00"
+ },
+ {
+ "id": 3666156943,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T15:21:46+00:00"
+ },
+ {
+ "id": 3667456239,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T20:32:03+00:00"
+ },
+ {
+ "id": 3671433327,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-16T15:26:44+00:00"
+ },
+ {
+ "id": 3673173260,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-16T23:53:35+00:00"
+ },
+ {
+ "id": 3700357459,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-24T01:27:20+00:00"
+ },
+ {
+ "id": 3701866155,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-24T15:50:49+00:00"
+ },
+ {
+ "id": 3718025497,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED], I have initial comments 👍",
+ "submitted_at": "2026-01-28T17:26:10+00:00"
+ },
+ {
+ "id": 3720081015,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T01:45:37+00:00"
+ },
+ {
+ "id": 3723445002,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks for adding the test, and many thanks for being super responsive! \n\nOne more finding for you.",
+ "submitted_at": "2026-01-29T15:33:56+00:00"
+ },
+ {
+ "id": 3723961630,
+ "user": "user_c010523698ce",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T17:02:42+00:00"
+ },
+ {
+ "id": 3724078186,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Wonderful, thank you!",
+ "submitted_at": "2026-01-29T17:29:01+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2692557078,
+ "user": "user_cdda8932ec17",
+ "body": "I think the problem has little to do with whether or not a primary key is targeted. The cast will be harmful in all case where the field is indexed for example.\n\nA better solution here would likely be to attempt `prev_field.to_python(...)` with the search term an in cases where the value is valid (no exception is raised) then don't perform a `Cast`.\n\nIn other words, `prev_field.to_python(\"123\")` (assuming it's an `IntegerField` instance) passes and returns `123` so we know that `field__exact=\"123\"` doesn't require a cast while `prev_field.to_python(\"foo\")` raises a `ValueError` so we know we must cast.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T00:46:41+00:00"
+ },
+ {
+ "id": 2692575770,
+ "user": "user_cdda8932ec17",
+ "body": "This is re-introducing the admin crash problem ticket-26001 fixed which you can demonstrate by doing\n\n```suggestion\n request = self.factory.get(\"/\", data={SEARCH_VAR: \"foo\"})\n```\n\nA cast (or an exclusion of terms) is necessary when dealing with string that are not string representation of integers.",
+ "path": "tests/admin_changelist/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T00:57:41+00:00"
+ },
+ {
+ "id": 2692610146,
+ "user": "user_c010523698ce",
+ "body": "Thanks. I was trying to keep things narrow and I've never messed around at this level of admin. I just pushed a tweak that uses `to_python`. I'm a bit over my head, but hopefully this addresses your concern.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T01:19:16+00:00"
+ },
+ {
+ "id": 2694820830,
+ "user": "user_cdda8932ec17",
+ "body": "This doesn't account for multiple search terms (see `smart_split(search_term)` below) where some might need cast and others don't.\n\nFor example, if your search for `foo 123` the resulting query should be\n\n```python\nalias(\n int_field_str=Cast(\"int_field\", TextField())\n).filter(\n Q(int_field_str=\"foo\") | Q(int_field=\"123\")\n)\n```\n\nwith your current path it'll be doing\n\n```python\nalias(\n int_field_str=Cast(\"int_field\", TextField())\n).filter(\n Q(int_field_str=\"foo\") | Q(int_field_str=123)\n)\n```\n\nSee how #18765 changed the logic to no longer be search term `bit` specific and how we might need to restore it.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T15:21:46+00:00"
+ },
+ {
+ "id": 2695860117,
+ "user": "user_c010523698ce",
+ "body": "Got it. You know, Claude suggested this yesterday and I thought it would be too invasive, but your suggestion on code.djangoproject.org is even better, and I've just pushed that, including another test to prevent regression.\n\nThank you again.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T20:32:03+00:00"
+ },
+ {
+ "id": 2698951633,
+ "user": "user_3a67c55598c5",
+ "body": "Given that, could I ask you to update the PR body \"solution\" part?",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-16T15:26:44+00:00"
+ },
+ {
+ "id": 2700348512,
+ "user": "user_c010523698ce",
+ "body": "Sure. Done.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-16T23:53:35+00:00"
+ },
+ {
+ "id": 2723384880,
+ "user": "user_cdda8932ec17",
+ "body": "You could re-assign `bit` here to use the proper expected type\n\n```suggestion\n but = validate_field.to_python(bit)\n```",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T01:27:20+00:00"
+ },
+ {
+ "id": 2724279784,
+ "user": "user_c010523698ce",
+ "body": "All set and pushed.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T15:50:49+00:00"
+ },
+ {
+ "id": 2737719890,
+ "user": "user_3a67c55598c5",
+ "body": "Did you give some thought to Simon's suggestion to use `.formfield()`? I expect some behavior differences, e.g.:\n\n```py\nIn [1]: from django.db.models.fields import [NAME_REDACTED] [2]: f = BooleanField()\n\nIn [3]: f.to_python('false')\n---------------------------------------------------------------------------\n[NAME_REDACTED] (most recent call last)\n[NAME_REDACTED][3], line 1\n----> 1 f.to_python('false')\n\nFile ~/django/django/db/models/fields/__init__.py:1179, in BooleanField.to_python(self, value)\n 1177 if value in (\"f\", \"False\", \"0\"):\n 1178 return False\n-> 1179 raise exceptions.ValidationError(\n 1180 self.error_messages[\"invalid_nullable\" if self.null else \"invalid\"],\n 1181 code=\"invalid\",\n 1182 params={\"value\": value},\n 1183 )\n\nValidationError: ['“false” value must be either True or False.']\n\nIn [4]: ff = f.formfield()\n\nIn [5]: ff.to_python('false')\nOut[5]: False\n\nIn [6]: ff.to_python('garbage')\nOut[6]: True\n```\n\nCan you look into this and add a test that will fail if the model field is used instead of the form field?",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T17:26:01+00:00"
+ },
+ {
+ "id": 2739394523,
+ "user": "user_c010523698ce",
+ "body": "Sorry, I missed their comment about this (and, again, I'm trying not to make many changes).\n\nI think it makes sense to be more lenient here and use formfields instead of model fields. I just pushed a tweak and a test accordingly. I don't have tests working locally, so I'll update Track once tests are set to go.\n\nThanks for the review.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T01:45:37+00:00"
+ },
+ {
+ "id": 2742232366,
+ "user": "user_3a67c55598c5",
+ "body": "I think we shouldn't shadow the outer loop variable.\n\nI found that with two fields, e.g. IntegerField and JSONField (and with search fields `[\"int__exact\", \"json__exact\"]`), a bit that was only valid as an int but not as json (e.g. \"3.\"), translated into valid `Q` objects for both fields instead of only the int field.\n\nThe `bit` from the `IntegerField.to_python()` result was still `3` on the second loop iteration, which became a valid input to `JSONField.to_python()`.\n\nCan you address & add a test?",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T15:30:27+00:00"
+ },
+ {
+ "id": 2742643434,
+ "user": "user_c010523698ce",
+ "body": "Nice catch, thanks. Fixed with a test and pushed.",
+ "path": "django/contrib/admin/options.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T17:02:42+00:00"
+ },
+ {
+ "id": 2742731412,
+ "user": "user_3a67c55598c5",
+ "body": "We could return some some sort of sentinel here that signals it's okay to skip this `orm_lookup` when calculating `may_have_duplicates` below, but this is just a subtle optimization opportunity to avoid a `distinct()` later on, and I'm comfortable leaving it for someone else in a follow-up 👍 .",
+ "path": "django/contrib/admin/options.py",
+ "line": 1202,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T17:24:03+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 13,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 14,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 14
+ }
+}
+{
+ "_id": "f1a029dced7a7245",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20535,
+ "title": "Fixed #36856 -- Mentioned needsnewfeatureprocess resolution in contributor docs.",
+ "body": "#### Trac ticket number\n\n ticket-36856\n\n #### Branch description\n\n Documents the new `needsnewfeatureprocess` resolution state in the triaging tickets documentation, as proposed in the [forum discussion](https://forum.djangoproject.com/t/volunteers-wanted-to-update-triage-workflow-docs/37937/).\n\n **Changes:**\n - Added `needsnewfeatureprocess` to the \"[NAME_REDACTED]\" section with description and reference to the new features process\n - Updated reopening guidance to include tickets marked as `needsnewfeatureprocess`\n - Updated contribution process diagram (SVG and PDF) to show the new closed state\n\n #### AI [NAME_REDACTED] (REQUIRED)\n\n - [x] **No AI tools were used** in preparing this PR.\n - [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n #### Checklist\n\n - [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/). \n - [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n - [x] This PR targets the `main` branch.\n - [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n - [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n - [ ] I have added or updated relevant tests.\n - [x] I have added or updated relevant docs, including release notes if applicable.\n - [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_e930d3b308e4",
+ "created_at": "2026-01-14T07:34:02+00:00",
+ "merged_at": "2026-01-15T12:27:02+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36856",
+ "additions": 16,
+ "deletions": 5,
+ "changed_files": 5,
+ "files": [
+ {
+ "filename": "docs/internals/_images/contribution_process.pdf",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 0,
+ "changes": 0,
+ "patch": null
+ },
+ {
+ "filename": "docs/internals/_images/contribution_process.svg",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": null
+ },
+ {
+ "filename": "docs/internals/contributing/bugs-and-features.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -27,6 +27,9 @@ Before reporting a bug on the `ticket tracker\n * Don't reopen issues that have been marked \"wontfix\" without finding consensus\n to do so on the `[NAME_REDACTED]`_.\n \n+* Don't reopen issues that have been marked \"needsnewfeatureprocess\" without\n+ shepherding an issue through the `new feature ideas`_ GitHub project.\n+\n * Don't use the ticket tracker for lengthy discussions, because they're\n likely to get lost. If a particular ticket is controversial, please move the\n discussion to the `[NAME_REDACTED]`_."
+ },
+ {
+ "filename": "docs/internals/contributing/triaging-tickets.txt",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 4,
+ "changes": 15,
+ "patch": "@@ -327,6 +327,11 @@ A ticket can be resolved in a number of ways:\n close a ticket. Always use the forum to get a consensus before reopening\n tickets closed as \"wontfix\".\n \n+* needsnewfeatureprocess\n+ Used when the ticket merits a new feature, which will need to get\n+ community input and support.\n+ See the :ref:`process for suggesting new features `.\n+\n * duplicate\n Used when another ticket covers the same issue. By [NAME_REDACTED], we keep all the discussion in one place, which helps\n@@ -344,8 +349,10 @@ A ticket can be resolved in a number of ways:\n If you believe that the ticket was closed in error -- because you're\n still having the issue, or it's popped up somewhere else, or the triagers have\n made a mistake -- please reopen the ticket and provide further information.\n-Again, please do not reopen tickets that have been marked as \"wontfix\" and\n-bring the issue to the `[NAME_REDACTED]`_ instead.\n+Again, please do not reopen tickets that have been marked as \"wontfix\" or\n+\"needsnewfeatureprocess\". For \"wontfix\" tickets, bring the issue to the\n+`[NAME_REDACTED]`_ instead. For \"needsnewfeatureprocess\" tickets, propose the\n+feature through the :ref:`new features process `.\n \n .. _how-can-i-help-with-triaging:\n \n@@ -361,8 +368,8 @@ reset page`_.\n \n Then, you can help out by:\n \n-* Closing \"Unreviewed\" tickets as \"invalid\", \"worksforme\", or \"duplicate\", or\n- \"wontfix\".\n+* Closing \"Unreviewed\" tickets as \"invalid\", \"worksforme\", \"duplicate\",\n+ \"wontfix\", or \"needsnewfeatureprocess\".\n \n * Closing \"Unreviewed\" tickets as \"needsinfo\" when the description is too\n sparse to be actionable."
+ },
+ {
+ "filename": "docs/spelling_wordlist",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -310,6 +310,7 @@ Nanggroe\n natively\n nd\n needsinfo\n+needsnewfeatureprocess\n německy\n nginx\n noding"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3660598215,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks 👍",
+ "submitted_at": "2026-01-14T12:54:16+00:00"
+ },
+ {
+ "id": 3662306424,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-14T18:59:37+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2690319748,
+ "user": "user_3a67c55598c5",
+ "body": "Can we update this to reflect that the next stop for `needsnewfeatureprocess` tickets is the new-features process/repo, not necessarily the forum?",
+ "path": "docs/internals/contributing/triaging-tickets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T12:54:09+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "pdf",
+ "svg",
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "1542f941074f65dc",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20528,
+ "title": "Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.",
+ "body": "ticket-36850\n#### Branch description\nThe fix removes `flex-wrap` from `.changelist-form-container` and adds `min-width` to the main content container to prevent the sidebar from wrapping below the changelist.\n\n#### Screenshot\n##### Before\n(Light mode)\n \n\n(Dark mode)\n \n\n##### After\n(Light mode)\n \n\n(Dark mode)\n \n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_d96dcc7f8ae4",
+ "created_at": "2026-01-12T18:45:23+00:00",
+ "merged_at": "2026-01-26T15:25:47+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36850",
+ "additions": 27,
+ "deletions": 3,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/contrib/admin/static/admin/css/changelists.css",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -2,7 +2,6 @@\n \n #changelist .changelist-form-container {\n display: flex;\n- flex-wrap: wrap;\n align-items: flex-start;\n width: 100%;\n }\n@@ -16,6 +15,7 @@\n }\n \n #changelist .changelist-form-container:has(#changelist-filter) > div {\n+ min-width: 0;\n max-width: calc(100% - 270px);\n }"
+ },
+ {
+ "filename": "docs/releases/6.0.2.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 1,
+ "changes": 5,
+ "patch": "@@ -9,4 +9,7 @@ Django 6.0.2 fixes several bugs in 6.0.1.\n Bugfixes\n ========\n \n-* ...\n+* Fixed a visual regression in Django 6.0 that caused the admin filter sidebar\n+ to wrap below the changelist when filter elements contained long text\n+ (:ticket:`36850`).\n+"
+ },
+ {
+ "filename": "tests/admin_views/models.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 1,
+ "changes": 8,
+ "patch": "@@ -266,7 +266,13 @@ class Person(models.Model):\n (2, \"Female\"),\n )\n name = models.CharField(max_length=100)\n- gender = models.IntegerField(choices=GENDER_CHOICES)\n+ gender = models.IntegerField(\n+ choices=GENDER_CHOICES,\n+ verbose_name=(\n+ \"very very very very very very very very very \"\n+ \"loooooooooooooooooooooooooooooooooooooooooong name\"\n+ ),\n+ )\n age = models.IntegerField(default=21)\n alive = models.BooleanField(default=True)"
+ },
+ {
+ "filename": "tests/admin_views/tests.py",
+ "status": "modified",
+ "additions": 15,
+ "deletions": 0,
+ "changes": 15,
+ "patch": "@@ -7205,6 +7205,21 @@ def test_pagination_layout(self):\n self.assertTrue(show_all.is_displayed())\n self.take_screenshot(\"pagination\")\n \n+ [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n+ def test_changelist_filter_sidebar_with_long_verbose_fields(self):\n+ from selenium.webdriver.common.by [NAME_REDACTED]\n+\n+ self.admin_login(\n+ username=\"super\", password=\"secret\", login_url=reverse(\"admin:index\")\n+ )\n+ Person.objects.create(name=\"John\", gender=1)\n+ self.selenium.get(\n+ self.live_server_url + reverse(\"admin:admin_views_person_changelist\")\n+ )\n+ changelist_filter = self.selenium.find_element(By.ID, \"changelist-filter\")\n+ self.assertTrue(changelist_filter.is_displayed())\n+ self.take_screenshot(\"filter_sidebar\")\n+\n \n [USER_REDACTED]_settings(ROOT_URLCONF=\"admin_views.urls\")\n class ReadonlyTest(AdminFieldExtractionMixin, TestCase):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3658487038,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": "Thank you for working on this [USER_REDACTED] :)\n\nI left a few comments for reference.\nPerhaps we need to include the changes for this part in the release note? (6.0.2)",
+ "submitted_at": "2026-01-14T01:23:52+00:00"
+ },
+ {
+ "id": 3673352351,
+ "user": "user_45c2e5489720",
+ "state": "APPROVED",
+ "body": "Thank you [USER_REDACTED] ! It looks good to me 🙌\n\n## Firefox\n\n \n\n## Safari\n\n \n\n## Edge\n\n \n\nOne thing I'm wondering about... the current test only has one field in the changelist. Would it be better to test with multiple fields?",
+ "submitted_at": "2026-01-17T01:24:21+00:00"
+ },
+ {
+ "id": 3678830235,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks both ⭐ \n\n[USER_REDACTED] can you update the PR body with the ultimate solution?",
+ "submitted_at": "2026-01-19T16:24:40+00:00"
+ },
+ {
+ "id": 3679942402,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-20T00:42:43+00:00"
+ },
+ {
+ "id": 3679960545,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-20T00:58:42+00:00"
+ },
+ {
+ "id": 3680139186,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-20T03:05:06+00:00"
+ },
+ {
+ "id": 3700423735,
+ "user": "user_45c2e5489720",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-24T02:22:53+00:00"
+ },
+ {
+ "id": 3706262504,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thank you!",
+ "submitted_at": "2026-01-26T14:21:22+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2688616076,
+ "user": "user_45c2e5489720",
+ "body": "For reference!\n\nI think it would be good if the filter layout works the same as before.\nPreviously, the filter sidebar maintained the same line even when its size increased.\n\n## 6.0\n\n \n\n## 5.0\n\n ",
+ "path": "django/contrib/admin/static/admin/css/changelists.css",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T01:19:38+00:00"
+ },
+ {
+ "id": 2688618929,
+ "user": "user_45c2e5489720",
+ "body": "```diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py\nindex 4e2d13efa8..edc13fe5ae 100644\n--- a/tests/admin_views/models.py\n+++ b/tests/admin_views/models.py\n@@ -668,7 +668,13 @@ class ReadOnlyPizza(Pizza):\n \n class Album(models.Model):\n owner = models.ForeignKey(User, models.SET_NULL, null=True, blank=True)\n- title = models.CharField(max_length=30)\n+ title = models.CharField(\n+ max_length=30,\n+ verbose_name=(\n+ \"very very very very very very very very very \"\n+ \"loooooooooooooooooooooooooooooooooooooooooong name\"\n+ )\n+ )\n \n \n class Song(models.Model):\ndiff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py\nindex 8ba3b53c41..96065d0846 100644\n--- a/tests/admin_views/tests.py\n+++ b/tests/admin_views/tests.py\n@@ -7086,18 +7086,19 @@ class SeleniumTests(AdminSeleniumTestCase):\n self.take_screenshot(\"pagination\")\n \n [USER_REDACTED]_cases([\"desktop_size\", \"mobile_size\", \"rtl\", \"dark\", \"high_contrast\"])\n- def test_changelist_filter_sidebar_width(self):\n+ def test_changelist_filter_sidebar_with_long_verbose_name(self):\n from selenium.webdriver.common.by [NAME_REDACTED]_login(\n username=\"super\", password=\"secret\", login_url=reverse(\"admin:index\")\n )\n+ Album.objects.create(title=\"oasis\")\n self.selenium.get(\n- self.live_server_url + reverse(\"admin:admin_views_person_changelist\")\n+ self.live_server_url + reverse(\"admin:admin_views_album_changelist\")\n )\n changelist_filter = self.selenium.find_element(By.ID, \"changelist-filter\")\n+ self.assertTrue(changelist_filter.is_displayed())\n # Verify the filter width is constrained to max-width (240px).\n- self.assertLessEqual(changelist_filter.rect[\"width\"], 240)\n self.take_screenshot(\"filter_sidebar\")\n```\n\nI think we can actually reproduce the issue when it has a `verbose_name` containing long words like this.\n\n ",
+ "path": "tests/admin_views/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T01:21:32+00:00"
+ },
+ {
+ "id": 2705395209,
+ "user": "user_3a67c55598c5",
+ "body": "```suggestion\n* Fixed a visual regression in Django 6.0 that caused the admin filter sidebar\n to wrap below ...\n```",
+ "path": "docs/releases/6.0.2.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T16:21:39+00:00"
+ },
+ {
+ "id": 2705396990,
+ "user": "user_3a67c55598c5",
+ "body": "The added test performs the same when I remove this. [USER_REDACTED] can you share why you suggested including it?",
+ "path": "django/contrib/admin/static/admin/css/changelists.css",
+ "line": 18,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T16:22:17+00:00"
+ },
+ {
+ "id": 2706395787,
+ "user": "user_45c2e5489720",
+ "body": "If the `min-width` property is not set, it becomes like this:\n\n \n\nThe conclusion is that it's to override `min-width: auto` inside flex.\nIn flex, `min-width: auto` guarantees the content size as the minimum limit, so if the content doesn't shrink, it pushes the adjacent elements.\nTherefore, I overrode it with `min-width: 0` to prevent it from pushing adjacent elements.\nPerhaps it wasn't caught in the screenshot test because it captures at a specific screen size? (I'll check on this.)",
+ "path": "django/contrib/admin/static/admin/css/changelists.css",
+ "line": 18,
+ "side": "RIGHT",
+ "created_at": "2026-01-20T00:42:43+00:00"
+ },
+ {
+ "id": 2706415192,
+ "user": "user_45c2e5489720",
+ "body": "After checking, it seems there was no difference because there wasn't enough content.\nWe'll need to add more fields!\n\nWould it be better to change the test model to `Person` here?\nIf we use `Person`, it seems like We wouldn't need to touch any `ModelAdmin` configuration.",
+ "path": "django/contrib/admin/static/admin/css/changelists.css",
+ "line": 18,
+ "side": "RIGHT",
+ "created_at": "2026-01-20T00:58:42+00:00"
+ },
+ {
+ "id": 2706595154,
+ "user": "user_3a67c55598c5",
+ "body": "That sounds like a good idea 👍🏻",
+ "path": "django/contrib/admin/static/admin/css/changelists.css",
+ "line": 18,
+ "side": "RIGHT",
+ "created_at": "2026-01-20T03:05:06+00:00"
+ },
+ {
+ "id": 2723442809,
+ "user": "user_45c2e5489720",
+ "body": "I seem to be failing to reproduce the issue 🥲\nThe filter sidebar size should increase.",
+ "path": "tests/admin_views/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-24T02:22:53+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "css",
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 6,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 8,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 8
+ }
+}
+{
+ "_id": "865c7e0a27ddef8c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20524,
+ "title": "Fixed #36801 -- Avoided unnecessary calculation in construct_change_message().",
+ "body": "#### Trac ticket number\n\nticket-36801\n\n#### Branch description\n\n`changed_field_labels` is only needed if there are changes to log, so move its calculation, including the somewhat costly `translation_override()`, inside the conditional that checks for changes. Also avoid reading `form.changed_data` when it’s already bound to `changed_data`.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_8fc305198eb3",
+ "created_at": "2026-01-10T20:45:18+00:00",
+ "merged_at": "2026-01-16T14:17:57+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36801",
+ "additions": 11,
+ "deletions": 11,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "django/contrib/admin/utils.py",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 11,
+ "changes": 22,
+ "patch": "@@ -552,21 +552,21 @@ def construct_change_message(form, formsets, add):\n Translations are deactivated so that strings are stored untranslated.\n Translation happens later on LogEntry access.\n \"\"\"\n+ change_message = []\n+ if add:\n+ change_message.append({\"added\": {}})\n # Evaluating `form.changed_data` prior to disabling translations is\n # required to avoid fields affected by [NAME_REDACTED]\n # incorrectly, e.g. where date formats differ such as MM/DD/YYYY vs\n # DD/MM/YYYY.\n- changed_data = form.changed_data\n- with translation_override(None):\n- # Deactivate translations while fetching verbose_name for form\n- # field labels and using `field_name`, if verbose_name is not provided.\n- # Translations will happen later on LogEntry access.\n- changed_field_labels = _get_changed_field_labels_from_form(form, changed_data)\n-\n- change_message = []\n- if add:\n- change_message.append({\"added\": {}})\n- elif form.changed_data:\n+ elif changed_data := form.changed_data:\n+ with translation_override(None):\n+ # Deactivate translations while fetching verbose_name for form\n+ # field labels and using `field_name`, if verbose_name is not\n+ # provided. Translations will happen later on LogEntry access.\n+ changed_field_labels = _get_changed_field_labels_from_form(\n+ form, changed_data\n+ )\n change_message.append({\"changed\": {\"fields\": changed_field_labels}})\n if formsets:\n with translation_override(None):"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3652219291,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "👍",
+ "submitted_at": "2026-01-12T18:49:21+00:00"
+ },
+ {
+ "id": 3661912459,
+ "user": "user_34c3f4acb8a8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T17:31:03+00:00"
+ },
+ {
+ "id": 3668225440,
+ "user": "user_8fc305198eb3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-16T00:31:53+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2691385394,
+ "user": "user_34c3f4acb8a8",
+ "body": "Thought: Given you mention `translation_override` is expensive, is there any way to combine these calls? It'd be nice to avoid needing to call it twice in the same call to `construct_change_message`.\n\nIt might end up being far more complex than is useful - just a thought.",
+ "path": "django/contrib/admin/utils.py",
+ "line": 572,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T17:31:03+00:00"
+ },
+ {
+ "id": 2696443224,
+ "user": "user_8fc305198eb3",
+ "body": "I can't see a way of doing that which isn't more complex than I think it's worth…",
+ "path": "django/contrib/admin/utils.py",
+ "line": 572,
+ "side": "RIGHT",
+ "created_at": "2026-01-16T00:31:53+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "e3b7725ad3786d64",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20519,
+ "title": "Fixed #35402 -- Fixed crash in DatabaseFeatures.django_test_skips when running a subset of tests.",
+ "body": "#### Trac ticket number\nticket-35402\n\n#### Branch description\nContinued from #18203.\n\nBecause the prior implementation of this skip machinery sent module names to `import_string()`, it was relying on a fragile behavior that depended on, in the case of submodules, the parent modules having already been imported, which isn't guaranteed.\n\nWe might want to take up Tim's suggestion in the ticket of deprecating providing module names to `import_string()` at some point.\n\n#### AI [NAME_REDACTED] (REQUIRED)\n\n- [x] **No AI tools were used** in preparing this PR.\n- [ ] **If AI tools were used**, I have disclosed which ones, and fully reviewed and verified their output.\n\n#### Checklist\n- [x] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/).\n- [x] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)).\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_3a67c55598c5",
+ "created_at": "2026-01-09T21:54:15+00:00",
+ "merged_at": "2026-01-14T13:25:37+00:00",
+ "base_branch": "main",
+ "head_branch": "issue-35402",
+ "additions": 35,
+ "deletions": 18,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/db/backends/base/creation.py",
+ "status": "modified",
+ "additions": 30,
+ "deletions": 18,
+ "changes": 48,
+ "patch": "@@ -358,27 +358,39 @@ def mark_expected_failures_and_skips(self):\n Mark tests in Django's test suite which are expected failures on this\n database and test which should be skipped on this database.\n \"\"\"\n- # Only load unittest if we're actually testing.\n- from unittest import expectedFailure, skip\n-\n for test_name in self.connection.features.django_test_expected_failures:\n- test_case_name, _, test_method_name = test_name.rpartition(\".\")\n- test_app = test_name.split(\".\")[0]\n- # Importing a test app that isn't installed raises RuntimeError.\n- if test_app in settings.INSTALLED_APPS:\n- test_case = import_string(test_case_name)\n- test_method = getattr(test_case, test_method_name)\n- setattr(test_case, test_method_name, expectedFailure(test_method))\n+ self._mark_test(test_name)\n for reason, tests in self.connection.features.django_test_skips.items():\n for test_name in tests:\n- test_case_name, _, test_method_name = test_name.rpartition(\".\")\n- test_app = test_name.split(\".\")[0]\n- # Importing a test app that isn't installed raises\n- # RuntimeError.\n- if test_app in settings.INSTALLED_APPS:\n- test_case = import_string(test_case_name)\n- test_method = getattr(test_case, test_method_name)\n- setattr(test_case, test_method_name, skip(reason)(test_method))\n+ self._mark_test(test_name, reason)\n+\n+ def _mark_test(self, test_name, skip_reason=None):\n+ # Only load unittest during testing.\n+ from unittest import expectedFailure, skip\n+\n+ module_or_class_name, _, name_to_mark = test_name.rpartition(\".\")\n+ test_app = test_name.split(\".\")[0]\n+ # Importing a test app that isn't installed raises RuntimeError.\n+ if test_app in settings.INSTALLED_APPS:\n+ try:\n+ test_frame = import_string(module_or_class_name)\n+ except ImportError:\n+ # import_string() can raise ImportError if a submodule's parent\n+ # module hasn't already been imported during test discovery.\n+ # This can happen in at least two cases:\n+ # 1. When running a subset of tests in a module, the test\n+ # runner won't import tests in that module's other\n+ # submodules.\n+ # 2. When the parallel test runner spawns workers with an empty\n+ # import cache.\n+ test_to_mark = import_string(test_name)\n+ test_frame = sys.modules.get(test_to_mark.__module__)\n+ else:\n+ test_to_mark = getattr(test_frame, name_to_mark)\n+ if skip_reason:\n+ setattr(test_frame, name_to_mark, skip(skip_reason)(test_to_mark))\n+ else:\n+ setattr(test_frame, name_to_mark, expectedFailure(test_to_mark))\n \n def sql_table_creation_suffix(self):\n \"\"\""
+ },
+ {
+ "filename": "tests/backends/base/test_creation.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 0,
+ "changes": 5,
+ "patch": "@@ -1,6 +1,7 @@\n import copy\n import datetime\n import os\n+import sys\n from unittest import mock\n \n from django.db import DEFAULT_DB_ALIAS, connection, connections\n@@ -333,6 +334,10 @@ def test_mark_expected_failures_and_skips(self):\n \"backends.base.test_creation.skip_test_function\",\n },\n }\n+ # Emulate the scenario where the parent module for\n+ # backends.base.test_creation has not been imported yet.\n+ popped_module = sys.modules.pop(\"backends.base\")\n+ self.addCleanup(sys.modules.__setitem__, \"backends.base\", popped_module)\n creation.mark_expected_failures_and_skips()\n self.assertIs(\n expected_failure_test_function.__unittest_expecting_failure__,"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3646016093,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": "Thanks for following up.",
+ "submitted_at": "2026-01-10T00:58:48+00:00"
+ },
+ {
+ "id": 3646305893,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-10T02:18:40+00:00"
+ },
+ {
+ "id": 3646317529,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-10T02:23:34+00:00"
+ },
+ {
+ "id": 3651698442,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T16:39:37+00:00"
+ },
+ {
+ "id": 3652679698,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T20:44:09+00:00"
+ },
+ {
+ "id": 3652921861,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T22:03:09+00:00"
+ },
+ {
+ "id": 3652933036,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T22:23:28+00:00"
+ },
+ {
+ "id": 3653238656,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-13T00:16:14+00:00"
+ },
+ {
+ "id": 3656810327,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-13T16:45:13+00:00"
+ },
+ {
+ "id": 3656813034,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-13T16:45:48+00:00"
+ },
+ {
+ "id": 3657411188,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-13T19:14:18+00:00"
+ },
+ {
+ "id": 3658255641,
+ "user": "user_657e90e5ae46",
+ "state": "APPROVED",
+ "body": "Sorry for so much bikeshedding. Thanks for working on this.",
+ "submitted_at": "2026-01-13T23:07:46+00:00"
+ },
+ {
+ "id": 3658365843,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T00:06:46+00:00"
+ },
+ {
+ "id": 3658367952,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T00:08:04+00:00"
+ },
+ {
+ "id": 3658380475,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T00:16:02+00:00"
+ },
+ {
+ "id": 3658405831,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T00:29:35+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2677999156,
+ "user": "user_657e90e5ae46",
+ "body": "There is no memory leak when using an inline method in this case?",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:20:18+00:00"
+ },
+ {
+ "id": 2678002877,
+ "user": "user_657e90e5ae46",
+ "body": "I prefer not to add blank lines under the guideline that comments are better to separate any blocks that would otherwise seem to need blank lines.",
+ "path": "tests/backends/base/test_creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:24:21+00:00"
+ },
+ {
+ "id": 2678003330,
+ "user": "user_657e90e5ae46",
+ "body": "As all bugs are ;-) (I think this sentence isn't needed.)",
+ "path": "tests/backends/base/test_creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:24:53+00:00"
+ },
+ {
+ "id": 2678004314,
+ "user": "user_657e90e5ae46",
+ "body": "I think it's more important to say something high-level like \"When running a subset of tests in a module, tests in that module's other submodules won't be imported by [NAME_REDACTED] must be manually imported to avoid a crash. The ImportError could be ignored but the second import catches nonexistent tests.\" I leave it to you about whether or not to include the implementation details you've described but it seems like it may be uneeded archaic details (about the implementation of `import_string()`, for example).",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:26:03+00:00"
+ },
+ {
+ "id": 2678009075,
+ "user": "user_657e90e5ae46",
+ "body": "the comma seems uneeded",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:31:00+00:00"
+ },
+ {
+ "id": 2678010177,
+ "user": "user_657e90e5ae46",
+ "body": "The comment wrapping looks too short to me (less than 79 characters.)",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:32:11+00:00"
+ },
+ {
+ "id": 2678027671,
+ "user": "user_657e90e5ae46",
+ "body": "I think this is actually unnecessary. If the import fails, that means the test isn't going to run, so decorating it isn't needed. In other words:\n```diff\ndiff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py\nindex 3ba9365a2c..34eae215a4 100644\n--- a/django/db/backends/base/creation.py\n+++ b/django/db/backends/base/creation.py\n@@ -364,8 +364,8 @@ class BaseDatabaseCreation:\n # the rightmost term was a submodule, and the remainder\n # is a module that hasn't been imported yet.\n # Import the test_method by [NAME_REDACTED]_name.\n- test_method = import_string(test_name)\n- test_case = sys.modules.get(test_method.__module__)\n+ import_string(test_name)\n+ return (None, None)\n else:\n test_method = getattr(test_case, class_or_method)\n return test_case, test_method\n@@ -378,7 +378,8 @@ class BaseDatabaseCreation:\n test_case, test_method = get_test(\n module_or_class_name, class_or_method_name, test_name\n )\n- setattr(test_case, class_or_method_name, expectedFailure(test_method))\n+ if test_case:\n+ setattr(test_case, class_or_method_name, expectedFailure(test_method))\n for reason, tests in self.connection.features.django_test_skips.items():\n for test_name in tests:\n module_or_class_name, _, class_or_method_name = test_name.rpartition(\n@@ -391,7 +392,8 @@ class BaseDatabaseCreation:\n test_case, test_method = get_test(\n module_or_class_name, class_or_method_name, test_name\n )\n- setattr(test_case, class_or_method_name, skip(reason)(test_method))\n+ if test_case:\n+ setattr(test_case, class_or_method_name, skip(reason)(test_method))\n \n def sql_table_creation_suffix(self):\n```\n\nAs I said in my other comment, the only reason the second import is useful is to catch typos in test names.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T00:51:48+00:00"
+ },
+ {
+ "id": 2678202475,
+ "user": "user_3a67c55598c5",
+ "body": "Oh good point. Let me look a little closer next week.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T02:18:40+00:00"
+ },
+ {
+ "id": 2678210208,
+ "user": "user_3a67c55598c5",
+ "body": "This gets called only once per test worker, so I don't think it's a meaningful number of objects. I just didn't want to clutter the module scope. Maybe I'll end up needing to hoist it up to the module to target it in a test.\n\nIt was a little early to request your review, but I'm glad I did as I need to look into your comment about unnecessary decoration.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T02:23:34+00:00"
+ },
+ {
+ "id": 2683053768,
+ "user": "user_3a67c55598c5",
+ "body": "I don't think we can assume that the test isn't going to run. `ImportError` can be emitted because it's problematic to use `import_string` on modules, and we're considering deprecating that use to remove the footgun.\n\nFor instance, if I apply the diff from the ticket, and add your proposal:\n```diff\ndiff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py\nindex e027c4ef09..f0a55055c9 100644\n--- a/django/db/backends/base/creation.py\n+++ b/django/db/backends/base/creation.py\n@@ -370,6 +370,7 @@ class BaseDatabaseCreation:\n # the rightmost term was a submodule, and the remainder\n # is a module that hasn't been imported yet.\n # Import the test_method by [NAME_REDACTED]_name.\n+ return None, None\n test_method = import_string(test_name)\n test_case = sys.modules.get(test_method.__module__)\n else:\n@@ -384,7 +385,8 @@ class BaseDatabaseCreation:\n test_case, test_method = get_test(\n module_or_class_name, class_or_method_name, test_name\n )\n- setattr(test_case, class_or_method_name, expectedFailure(test_method))\n+ if test_case:\n+ setattr(test_case, class_or_method_name, expectedFailure(test_method))\n for reason, tests in self.connection.features.django_test_skips.items():\n for test_name in tests:\n module_or_class_name, _, class_or_method_name = test_name.rpartition(\n@@ -397,7 +399,8 @@ class BaseDatabaseCreation:\n test_case, test_method = get_test(\n module_or_class_name, class_or_method_name, test_name\n )\n- setattr(test_case, class_or_method_name, skip(reason)(test_method))\n+ if test_case:\n+ setattr(test_case, class_or_method_name, skip(reason)(test_method))\n \n def sql_table_creation_suffix(self):\n \"\"\"\ndiff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py\nindex ed24341b5e..c20747a27c 100644\n--- a/django/db/backends/sqlite3/features.py\n+++ b/django/db/backends/sqlite3/features.py\n@@ -70,8 +70,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):\n def django_test_skips(self):\n skips = {\n \"SQLite stores values rounded to 15 significant digits.\": {\n- \"model_fields.test_decimalfield.DecimalFieldTests.\"\n- \"test_fetch_from_db_without_float_rounding\",\n+ \"model_fields.test_decimalfield.DecimalFieldTests\",\n },\n \"SQLite naively remakes the table on field alteration.\": {\n \"schema.tests.SchemaTests.test_unique_no_unnecessary_fk_drops\",\n```\n\nAnd invoke the tests like this with tests specified individually:\n```py\n./runtests.py model_fields.test_autofield model_fields.test_decimalfield --parallel=2\n```\n\nThen the test is not skipped:\n```py\nAssertionError: Decimal('0.100000000000000000000000000000') != Decimal('0.100000000000000000000000000005')\n\n----------------------------------------------------------------------\nRan 78 tests in 0.869s\n\nFAILED (failures=1)\n```",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T16:39:37+00:00"
+ },
+ {
+ "id": 2683850272,
+ "user": "user_657e90e5ae46",
+ "body": "You wrote \"import_string() sometimes raises ImportError given a module.\" However, I think the comment should give an example of what \"sometimes\" means.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T20:44:09+00:00"
+ },
+ {
+ "id": 2684060029,
+ "user": "user_3a67c55598c5",
+ "body": "Ah right. Let me know if [eff69c8](https://github.com/[USER_REDACTED]ngo/django/pull/20519/commits/eff69c8fdf351ef4612cbc1782e01be274176d25) still doesn't strike the right balance.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T22:03:09+00:00"
+ },
+ {
+ "id": 2684070759,
+ "user": "user_657e90e5ae46",
+ "body": "\"do not expect\" seems like a verbiage change from the previous sentence. Here's my suggestion:\n\nimport_string() can raise ImportError if a submodule's parent module hasn't already been imported during test discovery. This can happen in at least two cases:\n1. When running a subset of tests in a module, tests in that module's other submodules won't be imported by [NAME_REDACTED]\n2. When the parallel test runner spawns workers with an empty import cache.\n\nPlease correct any details that I got wrong.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T22:07:39+00:00"
+ },
+ {
+ "id": 2684073892,
+ "user": "user_657e90e5ae46",
+ "body": "I didn't know about the problem for the parallel test runner, and I think it's important to also describe the case I mentioned where it's not involved.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T22:08:53+00:00"
+ },
+ {
+ "id": 2684105502,
+ "user": "user_657e90e5ae46",
+ "body": "I hate this formatting and how other lines have to be multi-lined. I don't normally advocate for abbreviations, but I'm a bit tempted to abbreviate \"class\" -> \"cls\" if it avoids that.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T22:21:54+00:00"
+ },
+ {
+ "id": 2684338072,
+ "user": "user_3a67c55598c5",
+ "body": "I could also parenthesize the left-hand side. Fully agree about the lonely `\".\"`",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T00:16:14+00:00"
+ },
+ {
+ "id": 2687229683,
+ "user": "user_3a67c55598c5",
+ "body": "I like this. I applied your suggestion and removed the passive voice to fit on one fewer line.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T16:45:13+00:00"
+ },
+ {
+ "id": 2687231817,
+ "user": "user_3a67c55598c5",
+ "body": "Took the opportunity to factor out helper methods to address this and also remove nested functions at the same time 👍",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T16:45:48+00:00"
+ },
+ {
+ "id": 2687727509,
+ "user": "user_657e90e5ae46",
+ "body": "skip -> mark (since \"mark\" could be skip or expected failure)\nreason -> skip_reason",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T19:08:52+00:00"
+ },
+ {
+ "id": 2687741612,
+ "user": "user_657e90e5ae46",
+ "body": "test_to_mark?",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T19:11:56+00:00"
+ },
+ {
+ "id": 2687750804,
+ "user": "user_657e90e5ae46",
+ "body": "Perhaps it's better to follow the pattern in the rest of this file (at least with destroy_test_db/_destroy_test_db) and put the helper methods after the method that calls them. Otherwise, it seems to give more prominence to the helpers.",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T19:13:42+00:00"
+ },
+ {
+ "id": 2688397807,
+ "user": "user_657e90e5ae46",
+ "body": "We could clean this up to follow comment guidelines (no \"we\"): \"if we're actually\" -> \"during\"",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T23:03:09+00:00"
+ },
+ {
+ "id": 2688401895,
+ "user": "user_657e90e5ae46",
+ "body": "Does it still make sense to make this a method (vs. inline the logic) even though it's only called in one place?",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-13T23:05:22+00:00"
+ },
+ {
+ "id": 2688503727,
+ "user": "user_3a67c55598c5",
+ "body": "Ah, good point! Didn't notice that opportunity after the latest refactor 👍",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T00:06:46+00:00"
+ },
+ {
+ "id": 2688505614,
+ "user": "user_3a67c55598c5",
+ "body": "Yeah, I undid some edits that were no longer opportunistic once lines started moving around again, but now this is opportunistic 👍",
+ "path": "django/db/backends/base/creation.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T00:08:03+00:00"
+ },
+ {
+ "id": 2688517458,
+ "user": "user_3a67c55598c5",
+ "body": "Now that we lost the other helper's docstring suggesting what a \"frame\" is, I'm hoping this is sort of self-explanatory if in the 1-helper version you see it's the thing having `setattr()` run on it. (?)",
+ "path": "django/db/backends/base/creation.py",
+ "line": 376,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T00:16:02+00:00"
+ },
+ {
+ "id": 2688540517,
+ "user": "user_657e90e5ae46",
+ "body": "Looks okay to me.",
+ "path": "django/db/backends/base/creation.py",
+ "line": 376,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T00:29:35+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 15,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 27,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 27
+ }
+}
+{
+ "_id": "2eb5ec539fba0923",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20510,
+ "title": "Fixed #36852 -- Ignored index_type case in ExclusionConstraint.__eq__().",
+ "body": "#### Trac ticket number\n\n\n[ticket-36852](https://code.djangoproject.com/ticket/36852)\n\n#### Branch description\n\nIgnore case of index_type in `ExclusionConstraint` in equality check.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_d2d82edb4e7b",
+ "created_at": "2026-01-08T08:08:17+00:00",
+ "merged_at": "2026-01-08T16:33:53+00:00",
+ "base_branch": "main",
+ "head_branch": "postgres-exclusion-constraint-eq",
+ "additions": 21,
+ "deletions": 1,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/contrib/postgres/constraints.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -148,7 +148,7 @@ def __eq__(self, other):\n if isinstance(other, self.__class__):\n return (\n self.name == other.name\n- and self.index_type == other.index_type\n+ and self.index_type.lower() == other.index_type.lower()\n and self.expressions == other.expressions\n and self.condition == other.condition\n and self.deferrable == other.deferrable"
+ },
+ {
+ "filename": "tests/postgres_tests/test_constraints.py",
+ "status": "modified",
+ "additions": 20,
+ "deletions": 0,
+ "changes": 20,
+ "patch": "@@ -535,6 +535,24 @@ def test_eq(self):\n ],\n include=[\"cancelled\"],\n )\n+ constraint_8 = ExclusionConstraint(\n+ index_type=\"gist\",\n+ name=\"exclude_overlapping\",\n+ expressions=[\n+ (\"datespan\", RangeOperators.OVERLAPS),\n+ (\"room\", RangeOperators.EQUAL),\n+ ],\n+ include=[\"cancelled\"],\n+ )\n+ constraint_9 = ExclusionConstraint(\n+ index_type=\"GIST\",\n+ name=\"exclude_overlapping\",\n+ expressions=[\n+ (\"datespan\", RangeOperators.OVERLAPS),\n+ (\"room\", RangeOperators.EQUAL),\n+ ],\n+ include=[\"cancelled\"],\n+ )\n constraint_10 = ExclusionConstraint(\n name=\"exclude_overlapping\",\n expressions=[\n@@ -572,6 +590,8 @@ def test_eq(self):\n self.assertNotEqual(constraint_2, constraint_3)\n self.assertNotEqual(constraint_2, constraint_4)\n self.assertNotEqual(constraint_2, constraint_7)\n+ self.assertEqual(constraint_7, constraint_8)\n+ self.assertEqual(constraint_7, constraint_9)\n self.assertNotEqual(constraint_4, constraint_5)\n self.assertNotEqual(constraint_5, constraint_6)\n self.assertNotEqual(constraint_1, object())"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3638801922,
+ "user": "user_606ba1f2b93c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T10:36:30+00:00"
+ },
+ {
+ "id": 3639044214,
+ "user": "user_d2d82edb4e7b",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T11:47:36+00:00"
+ },
+ {
+ "id": 3639064095,
+ "user": "user_606ba1f2b93c",
+ "state": "APPROVED",
+ "body": "Commit message will need editing but otherwise LGTM. Thanks 🏆",
+ "submitted_at": "2026-01-08T11:53:19+00:00"
+ },
+ {
+ "id": 3639628384,
+ "user": "user_c332d334e171",
+ "state": "APPROVED",
+ "body": "LGTM",
+ "submitted_at": "2026-01-08T14:15:56+00:00"
+ },
+ {
+ "id": 3640245678,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks!",
+ "submitted_at": "2026-01-08T16:32:42+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2671817073,
+ "user": "user_606ba1f2b93c",
+ "body": "Since this is a bug, we won't need a release note.",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T10:35:20+00:00"
+ },
+ {
+ "id": 2672040778,
+ "user": "user_d2d82edb4e7b",
+ "body": "removed",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T11:47:36+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 3
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "0a5418d47adda99c",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20507,
+ "title": "Relocated content from docs/topics/external-packages.txt where appropriate.",
+ "body": "Following up a [forum post](https://forum.djangoproject.com/t/possible-merging-of-2-doc-pages/42819/6) and a conversation with the [NAME_REDACTED], it was decided to remove the docs/topics/external-packages.txt to avoid confusion with the Ecosystem page. Relevant content was moved to their related sections, except for `django-contrib-comments` which is not actively maintained.\n\n#### Checklist\n- [X] This PR targets the `main` branch. \n- [X] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [X] I have added or updated relevant docs, including release notes if applicable.",
+ "author": "user_00dac951cdbf",
+ "created_at": "2026-01-07T20:10:51+00:00",
+ "merged_at": "2026-01-08T13:50:57+00:00",
+ "base_branch": "main",
+ "head_branch": "external-packages-no-more",
+ "additions": 14,
+ "deletions": 53,
+ "changed_files": 5,
+ "files": [
+ {
+ "filename": "docs/ref/models/fields.txt",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 10,
+ "changes": 10,
+ "patch": "@@ -10,16 +10,6 @@ Model field reference\n This document contains all the API references of :class:`Field` including the\n `field options`_ and `field types`_ Django offers.\n \n-.. seealso::\n-\n- If the built-in fields don't do the trick, you can try\n- :pypi:`django-localflavor` (`documentation\n- `_), which contains assorted\n- pieces of code that are useful for particular countries and cultures.\n-\n- Also, you can easily :doc:`write your own custom model fields\n- `.\n-\n .. note::\n \n Fields are defined in :mod:`django.db.models.fields`, but for convenience"
+ },
+ {
+ "filename": "docs/topics/external-packages.txt",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 38,
+ "changes": 38,
+ "patch": "@@ -1,38 +0,0 @@\n-=================\n-External packages\n-=================\n-\n-Django ships with a variety of extra, optional tools that solve common\n-problems (``contrib.*``). For easier maintenance and to trim the size of the\n-codebase, a few of those applications have been moved out to separate projects.\n-\n-Localflavor\n-===========\n-\n-``django-localflavor`` is a collection of utilities for particular countries\n-and cultures.\n-\n-* `GitHub `__\n-* `Documentation `__\n-* :pypi:`PyPI `\n-\n-Comments\n-========\n-\n-``django-contrib-comments`` can be used to attach comments to any model, so you\n-can use it for comments on blog entries, photos, book chapters, or anything\n-else. Most users will be better served with a custom solution, or a hosted\n-product like Disqus.\n-\n-* `GitHub `__\n-* `Documentation `__\n-* :pypi:`PyPI `\n-\n-Formtools\n-=========\n-\n-``django-formtools`` is a collection of assorted utilities to work with forms.\n-\n-* `GitHub `__\n-* `Documentation `__\n-* :pypi:`PyPI `"
+ },
+ {
+ "filename": "docs/topics/forms/index.txt",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 4,
+ "changes": 10,
+ "patch": "@@ -802,10 +802,8 @@ Useful attributes on ``{{ field }}`` include:\n ``{{ field.value }}``\n The value of the field. e.g ``[EMAIL_REDACTED]``.\n \n-.. seealso::\n-\n- For a complete list of attributes and methods, see\n- :class:`~django.forms.BoundField`.\n+For a complete list of attributes and methods, see the reference guide for\n+:class:`~django.forms.BoundField`.\n \n Looping over hidden and visible fields\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n@@ -858,3 +856,7 @@ This covers the basics, but forms can do a whole lot more:\n :doc:`The Forms Reference `\n Covers the full API reference, including form fields, form widgets,\n and form and field validation.\n+\n+ :pypi:`django-formtools`\n+ Provides additional form utilities, such as form previews and wizards\n+ (`documentation `_)."
+ },
+ {
+ "filename": "docs/topics/i18n/formatting.txt",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -47,6 +47,14 @@ argument::\n product = forms.CharField()\n revenue = forms.DecimalField(max_digits=4, decimal_places=2, localize=True)\n \n+Locale specific helpers\n+-----------------------\n+\n+For country specific form fields, validation, and data formats that are not\n+included in Django itself, consider using the :pypi:`django-localflavor`\n+package, which provides localized form fields and utilities for many countries\n+and regions (`documentation `_).\n+\n .. _topic-l10n-templates:\n \n Controlling localization in templates"
+ },
+ {
+ "filename": "docs/topics/index.txt",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 1,
+ "changes": 1,
+ "patch": "@@ -31,6 +31,5 @@ Introductions to all the key parts of Django you'll need to know:\n settings\n signals\n checks\n- external-packages\n async\n tasks"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3636632884,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-07T20:12:00+00:00"
+ },
+ {
+ "id": 3636633996,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-07T20:12:24+00:00"
+ },
+ {
+ "id": 3636635520,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-07T20:12:51+00:00"
+ },
+ {
+ "id": 3636678488,
+ "user": "user_6b79e26637e6",
+ "state": "COMMENTED",
+ "body": "Thanks for getting this done quickly. I have a handful of small suggestions. I'm not strongly tied to them though.",
+ "submitted_at": "2026-01-07T20:34:20+00:00"
+ },
+ {
+ "id": 3639123107,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T12:11:55+00:00"
+ },
+ {
+ "id": 3639143740,
+ "user": "user_00dac951cdbf",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T12:18:22+00:00"
+ },
+ {
+ "id": 3639158505,
+ "user": "user_6b79e26637e6",
+ "state": "APPROVED",
+ "body": "Good stuff! Thank you",
+ "submitted_at": "2026-01-08T12:22:55+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2669934896,
+ "user": "user_00dac951cdbf",
+ "body": "This is already mentioned below in this doc in the `Field` section: https://docs.djangoproject.com/en/6.0/ref/models/fields/#field-api-reference",
+ "path": "docs/ref/models/fields.txt",
+ "line": 21,
+ "side": "LEFT",
+ "created_at": "2026-01-07T20:12:01+00:00"
+ },
+ {
+ "id": 2669935943,
+ "user": "user_00dac951cdbf",
+ "body": "This was moved to the i18n docs.",
+ "path": "docs/ref/models/fields.txt",
+ "line": 18,
+ "side": "LEFT",
+ "created_at": "2026-01-07T20:12:24+00:00"
+ },
+ {
+ "id": 2669937311,
+ "user": "user_00dac951cdbf",
+ "body": "This is a separated commit to improve the flow of this quite lengthy file.",
+ "path": "docs/topics/forms/index.txt",
+ "line": 806,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T20:12:51+00:00"
+ },
+ {
+ "id": 2669975399,
+ "user": "user_6b79e26637e6",
+ "body": "```suggestion\n Provides additional form utilities, such as form previews and wizards\n```\n\nThe extra word makes it clearer what `django-formtools` does.",
+ "path": "docs/topics/forms/index.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T20:27:50+00:00"
+ },
+ {
+ "id": 2669978435,
+ "user": "user_6b79e26637e6",
+ "body": "```suggestion\nincluded in Django itself, consider using the :pypi:`django-localflavor`\n```\nI don't think the qualifier \"external\" is as helpful now. I'm not sure what that means compared to third-party package and without the external-packages section, casual readers are less likely to know the difference (if there is one).",
+ "path": "docs/topics/i18n/formatting.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T20:28:57+00:00"
+ },
+ {
+ "id": 2669984426,
+ "user": "user_6b79e26637e6",
+ "body": "```suggestion\n``django-localflavor`` provides localized form fields and utilities for many\ncountries, cultures, and regions.\n```\n\nI don't think we need to justify why it's maintained elsewhere in the documentation. The reader likely doesn't care and if they do, the package's documentation can provide that historical context.",
+ "path": "docs/topics/i18n/formatting.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T20:31:03+00:00"
+ },
+ {
+ "id": 2672112283,
+ "user": "user_00dac951cdbf",
+ "body": "Incorporating!",
+ "path": "docs/topics/forms/index.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T12:11:55+00:00"
+ },
+ {
+ "id": 2672130766,
+ "user": "user_00dac951cdbf",
+ "body": "Agreed, made shorter and cleaner (IMHO).",
+ "path": "docs/topics/i18n/formatting.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T12:18:21+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "txt"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 6,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 8,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 8
+ }
+}
+{
+ "_id": "0f894cf254e8ed8b",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20505,
+ "title": "Fixed #36812 -- Dropped support for MariaDB < 10.11.",
+ "body": "#### Trac ticket number\n\n\nticket-36812\n\n#### Branch description\n Dropped the support for MariaDB 10.6-10.10.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_f5eee7dbaa84",
+ "created_at": "2026-01-07T12:44:53+00:00",
+ "merged_at": "2026-01-25T10:51:03+00:00",
+ "base_branch": "main",
+ "head_branch": "fix36812",
+ "additions": 19,
+ "deletions": 22,
+ "changed_files": 7,
+ "files": [
+ {
+ "filename": "django/db/backends/mysql/features.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 5,
+ "changes": 7,
+ "patch": "@@ -64,7 +64,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):\n [USER_REDACTED]_property\n def minimum_database_version(self):\n if self.connection.mysql_is_mariadb:\n- return (10, 6)\n+ return (10, 11)\n else:\n return (8, 4)\n \n@@ -207,8 +207,6 @@ def can_introspect_json_field(self):\n def supports_index_column_ordering(self):\n if self._mysql_storage_engine != \"InnoDB\":\n return False\n- if self.connection.mysql_is_mariadb:\n- return self.connection.mysql_version >= (10, 8)\n return True\n \n [USER_REDACTED]_property\n@@ -220,8 +218,7 @@ def supports_expression_indexes(self):\n \n [USER_REDACTED]_property\n def has_native_uuid_field(self):\n- is_mariadb = self.connection.mysql_is_mariadb\n- return is_mariadb and self.connection.mysql_version >= (10, 7)\n+ return self.connection.mysql_is_mariadb\n \n [USER_REDACTED]_property\n def allows_group_by_selected_pks(self):"
+ },
+ {
+ "filename": "docs/ref/databases.txt",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -421,7 +421,7 @@ non-durable `_.\n MariaDB notes\n =============\n \n-Django supports MariaDB 10.6 and higher.\n+Django supports MariaDB 10.11 and higher.\n \n To use MariaDB, use the MySQL backend, which is shared between the two. See the\n :ref:`MySQL notes ` for more details."
+ },
+ {
+ "filename": "docs/ref/models/fields.txt",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 5,
+ "changes": 10,
+ "patch": "@@ -1649,8 +1649,8 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional\n .. class:: UUIDField(**options)\n \n A field for storing universally unique identifiers. Uses Python's\n-:class:`~python:uuid.UUID` class. When used on PostgreSQL and MariaDB 10.7+,\n-this stores in a ``uuid`` datatype, otherwise in a ``char(32)``.\n+:class:`~python:uuid.UUID` class. When used on PostgreSQL and MariaDB, this\n+stores in a ``uuid`` datatype, otherwise in a ``char(32)``.\n \n Universally unique identifiers are a good alternative to :class:`AutoField` for\n :attr:`~Field.primary_key`. The database will not generate the UUID for you, so\n@@ -1667,13 +1667,13 @@ it is recommended to use :attr:`~Field.default`::\n Note that a callable (with the parentheses omitted) is passed to ``default``,\n not an instance of ``UUID``.\n \n-.. admonition:: Lookups on PostgreSQL and MariaDB 10.7+\n+.. admonition:: Lookups on PostgreSQL and [NAME_REDACTED] :lookup:`iexact`, :lookup:`contains`, :lookup:`icontains`,\n :lookup:`startswith`, :lookup:`istartswith`, :lookup:`endswith`, or\n :lookup:`iendswith` lookups on PostgreSQL don't work for values without\n- hyphens, because PostgreSQL and MariaDB 10.7+ store them in a hyphenated\n- uuid datatype type.\n+ hyphens, because PostgreSQL and MariaDB store them in a hyphenated uuid\n+ datatype type.\n \n .. _relationship-fields:"
+ },
+ {
+ "filename": "docs/ref/models/indexes.txt",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 5,
+ "changes": 5,
+ "patch": "@@ -81,11 +81,6 @@ field's name.\n For example ``Index(fields=['headline', '-pub_date'])`` would create SQL with\n ``(headline, pub_date DESC)``.\n \n-.. admonition:: MariaDB\n-\n- Index ordering isn't supported on MariaDB < 10.8. In that case, a\n- descending index is created as a normal index.\n-\n ``name``\n --------"
+ },
+ {
+ "filename": "docs/ref/models/querysets.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 4,
+ "changes": 7,
+ "patch": "@@ -1988,10 +1988,9 @@ them:\n , ...]>\n \n The ``postgresql``, ``oracle``, and ``mysql`` database backends support\n-``select_for_update()``. However, MariaDB only supports the ``nowait``\n-argument, MariaDB 10.6+ also supports the ``skip_locked`` argument, and MySQL\n-supports the ``nowait``, ``skip_locked``, and ``of`` arguments. The ``no_key``\n-argument is only supported on PostgreSQL.\n+``select_for_update()``. However, MariaDB only supports the ``nowait`` and\n+``skip_locked`` arguments, and MySQL supports the ``nowait``, ``skip_locked``,\n+and ``of`` arguments. The ``no_key`` argument is only supported on PostgreSQL.\n \n Passing ``nowait=True``, ``skip_locked=True``, ``no_key=True``, or ``of`` to\n ``select_for_update()`` using database backends that do not support these"
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -403,6 +403,12 @@ Dropped support for MySQL < 8.4\n Upstream support for MySQL 8.0 ends in April 2026, and MySQL 8.1-8.3 are\n short-term innovation releases. Django 6.1 supports MySQL 8.4 and higher.\n \n+Dropped support for MariaDB < 10.11\n+-----------------------------------\n+\n+Upstream support for MariaDB 10.6 ends in July 2026, and MariaDB 10.7-10.10 are\n+short-term maintenance releases. Django 6.1 supports MariaDB 10.11 and higher.\n+\n Miscellaneous\n -------------"
+ },
+ {
+ "filename": "tests/backends/mysql/tests.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -106,8 +106,8 @@ class Tests(TestCase):\n [USER_REDACTED].patch.object(connection, \"get_database_version\")\n def test_check_database_version_supported(self, mocked_get_database_version):\n if connection.mysql_is_mariadb:\n- mocked_get_database_version.return_value = (10, 5)\n- msg = \"MariaDB 10.6 or later is required (found 10.5).\"\n+ mocked_get_database_version.return_value = (10, 10)\n+ msg = \"MariaDB 10.11 or later is required (found 10.10).\"\n else:\n mocked_get_database_version.return_value = (8, 0, 31)\n msg = \"MySQL 8.4 or later is required (found 8.0.31).\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3703380571,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-25T07:21:51+00:00"
+ },
+ {
+ "id": 3703381993,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-25T07:25:46+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2725033573,
+ "user": "user_5501cd6d3dc8",
+ "body": "We shouldn't mention MariaDB twice:\n```suggestion\nand ``skip_locked`` arguments, and MySQL ...\n```",
+ "path": "docs/ref/models/querysets.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-25T07:21:50+00:00"
+ },
+ {
+ "id": 2725035546,
+ "user": "user_5501cd6d3dc8",
+ "body": "We should mention all dropped releases.",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-25T07:25:46+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": false,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "3e87fc86db433519",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.546480+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20498,
+ "title": "Fixed #36841 -- Made multipart parser class pluggable on HttpRequest.",
+ "body": "#### Trac ticket number\n\n\nticket-36841\n\n#### Branch description\nProvide a concise overview of the issue or rationale behind the proposed changes.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_b42982f63633",
+ "created_at": "2026-01-05T19:36:17+00:00",
+ "merged_at": "2026-02-10T22:59:02+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36841_",
+ "additions": 114,
+ "deletions": 3,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/http/request.py",
+ "status": "modified",
+ "additions": 17,
+ "deletions": 1,
+ "changes": 18,
+ "patch": "@@ -56,6 +56,7 @@ class HttpRequest:\n # The encoding used in GET/POST dicts. None means use default setting.\n _encoding = None\n _upload_handlers = []\n+ _multipart_parser_class = MultiPartParser\n \n def __init__(self):\n # WARNING: The `WSGIRequest` subclass doesn't call `super`.\n@@ -364,6 +365,19 @@ def upload_handlers(self, upload_handlers):\n )\n self._upload_handlers = upload_handlers\n \n+ [USER_REDACTED]\n+ def multipart_parser_class(self):\n+ return self._multipart_parser_class\n+\n+ [USER_REDACTED]_parser_class.setter\n+ def multipart_parser_class(self, multipart_parser_class):\n+ if hasattr(self, \"_files\"):\n+ raise RuntimeError(\n+ \"You cannot set the multipart parser class after the upload has been \"\n+ \"processed.\"\n+ )\n+ self._multipart_parser_class = multipart_parser_class\n+\n def parse_file_upload(self, META, post_data):\n \"\"\"Return a tuple of (POST QueryDict, FILES MultiValueDict).\"\"\"\n self.upload_handlers = ImmutableList(\n@@ -373,7 +387,9 @@ def parse_file_upload(self, META, post_data):\n \"processed.\"\n ),\n )\n- parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)\n+ parser = self.multipart_parser_class(\n+ META, post_data, self.upload_handlers, self.encoding\n+ )\n return parser.parse()\n \n [USER_REDACTED]"
+ },
+ {
+ "filename": "docs/ref/request-response.txt",
+ "status": "modified",
+ "additions": 24,
+ "deletions": 0,
+ "changes": 24,
+ "patch": "@@ -218,6 +218,30 @@ All attributes should be considered read-only, unless stated otherwise.\n executed before URL resolving takes place (you can use it in\n :meth:`process_view` though).\n \n+.. attribute:: HttpRequest.multipart_parser_class\n+\n+ .. versionadded:: 6.1\n+\n+ The class used to parse ``multipart/form-data`` request data. By default,\n+ this is ``django.http.multipartparser.MultiPartParser``.\n+\n+ You can set this attribute to use a custom multipart parser, either via\n+ middleware or directly in views::\n+\n+ from django.http.multipartparser import MultiPartParser\n+\n+\n+ class CustomMultiPartParser(MultiPartParser):\n+ def parse(self):\n+ post = QueryDict(mutable=True)\n+ files = MultiValueDict()\n+ # Custom processing logic here\n+ return post, files\n+\n+\n+ # In middleware or view:\n+ request.multipart_parser_class = CustomMultiPartParser\n+\n Attributes set by [NAME_REDACTED]\n ----------------------------------"
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 1,
+ "changes": 3,
+ "patch": "@@ -295,7 +295,8 @@ [NAME_REDACTED] and Responses\n ~~~~~~~~~~~~~~~~~~~~~~\n \n-* ...\n+* :attr:`HttpRequest.multipart_parser_class `\n+ can now be customized to use a different multipart parser class.\n \n Security\n ~~~~~~~~"
+ },
+ {
+ "filename": "tests/requests_tests/tests.py",
+ "status": "modified",
+ "additions": 71,
+ "deletions": 1,
+ "changes": 72,
+ "patch": "@@ -13,7 +13,11 @@\n RawPostDataException,\n UnreadablePostError,\n )\n-from django.http.multipartparser import MAX_TOTAL_HEADER_SIZE, MultiPartParserError\n+from django.http.multipartparser import (\n+ MAX_TOTAL_HEADER_SIZE,\n+ MultiPartParser,\n+ MultiPartParserError,\n+)\n from django.http.request import split_domain_port\n from django.test import RequestFactory, SimpleTestCase, override_settings\n from django.test.client import BOUNDARY, MULTIPART_CONTENT, FakePayload\n@@ -1112,6 +1116,72 @@ def test_deepcopy(self):\n request.session[\"key\"] = \"value\"\n self.assertEqual(request_copy.session, {})\n \n+ def test_custom_multipart_parser_class(self):\n+\n+ class CustomMultiPartParser(MultiPartParser):\n+ def parse(self):\n+ post, files = super().parse()\n+ post._mutable = True\n+ post[\"custom_parser_used\"] = \"yes\"\n+ post._mutable = False\n+ return post, files\n+\n+ class CustomWSGIRequest(WSGIRequest):\n+ multipart_parser_class = CustomMultiPartParser\n+\n+ payload = FakePayload(\n+ \"\\r\\n\".join(\n+ [\n+ \"--boundary\",\n+ 'Content-Disposition: form-data; name=\"name\"',\n+ \"\",\n+ \"value\",\n+ \"--boundary--\",\n+ ]\n+ )\n+ )\n+ request = CustomWSGIRequest(\n+ {\n+ \"REQUEST_METHOD\": \"POST\",\n+ \"CONTENT_TYPE\": \"multipart/form-data; boundary=boundary\",\n+ \"CONTENT_LENGTH\": len(payload),\n+ \"wsgi.input\": payload,\n+ }\n+ )\n+ self.assertEqual(request.POST.get(\"custom_parser_used\"), \"yes\")\n+ self.assertEqual(request.POST.get(\"name\"), \"value\")\n+\n+ def test_multipart_parser_class_immutable_after_parse(self):\n+ payload = FakePayload(\n+ \"\\r\\n\".join(\n+ [\n+ \"--boundary\",\n+ 'Content-Disposition: form-data; name=\"name\"',\n+ \"\",\n+ \"value\",\n+ \"--boundary--\",\n+ ]\n+ )\n+ )\n+ request = WSGIRequest(\n+ {\n+ \"REQUEST_METHOD\": \"POST\",\n+ \"CONTENT_TYPE\": \"multipart/form-data; boundary=boundary\",\n+ \"CONTENT_LENGTH\": len(payload),\n+ \"wsgi.input\": payload,\n+ }\n+ )\n+\n+ # Access POST to trigger parsing.\n+ request.POST\n+\n+ msg = (\n+ \"You cannot set the multipart parser class after the upload has been \"\n+ \"processed.\"\n+ )\n+ with self.assertRaisesMessage(RuntimeError, msg):\n+ request.multipart_parser_class = MultiPartParser\n+\n \n class HostValidationTests(SimpleTestCase):\n poisoned_hosts = ["
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3632090965,
+ "user": "user_a0755d1ae088",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-06T18:53:55+00:00"
+ },
+ {
+ "id": 3632101943,
+ "user": "user_b42982f63633",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-06T18:55:44+00:00"
+ },
+ {
+ "id": 3632358156,
+ "user": "user_c332d334e171",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-06T20:19:07+00:00"
+ },
+ {
+ "id": 3723671318,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED]!\n\nDid you have a look at Carlton's advice from the new-features repo to check that the parser contract was reasonably consistent?\n- `__init__()`\n- `parse()`\n- leave `QueryDict` immutable\n- ...?\n\nAny edge cases? (variance in where exactly is encoding checked?) Any ideas about whether this needs a sentence or two of docs?\n\nFinally, can you update the body of the PR with a sentence or so about the motivation?\nThanks!",
+ "submitted_at": "2026-01-29T16:31:52+00:00"
+ },
+ {
+ "id": 3723837194,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T16:38:22+00:00"
+ },
+ {
+ "id": 3724675639,
+ "user": "user_bddf51c3ef59",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T19:46:44+00:00"
+ },
+ {
+ "id": 3724762873,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-29T20:04:25+00:00"
+ },
+ {
+ "id": 3726599137,
+ "user": "user_bddf51c3ef59",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T06:33:22+00:00"
+ },
+ {
+ "id": 3728908846,
+ "user": "user_35035b8a218c",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-30T15:18:45+00:00"
+ },
+ {
+ "id": 3736208128,
+ "user": "user_cb2fc5a53d8e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-01T17:21:08+00:00"
+ },
+ {
+ "id": 3736467131,
+ "user": "user_bddf51c3ef59",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-01T18:39:01+00:00"
+ },
+ {
+ "id": 3736469833,
+ "user": "user_bddf51c3ef59",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-01T18:40:58+00:00"
+ },
+ {
+ "id": 3748063859,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-03T23:01:18+00:00"
+ },
+ {
+ "id": 3763821792,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-06T15:50:18+00:00"
+ },
+ {
+ "id": 3763843748,
+ "user": "user_b42982f63633",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-06T15:54:57+00:00"
+ },
+ {
+ "id": 3782023080,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-02-10T22:46:09+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2665945334,
+ "user": "user_a0755d1ae088",
+ "body": "```suggestion\n this is :class:`django.http.multipartparser.MultiPartParser`.\n```\nfor deep linking to the Sphinx documentation if it exists.",
+ "path": "docs/ref/request-response.txt",
+ "line": 226,
+ "side": "RIGHT",
+ "created_at": "2026-01-06T18:51:57+00:00"
+ },
+ {
+ "id": 2665955080,
+ "user": "user_b42982f63633",
+ "body": "It doesn't exist. I tried it.",
+ "path": "docs/ref/request-response.txt",
+ "line": 226,
+ "side": "RIGHT",
+ "created_at": "2026-01-06T18:55:44+00:00"
+ },
+ {
+ "id": 2742422674,
+ "user": "user_3a67c55598c5",
+ "body": "small detail: \"added\" annotations usually go at the top, \"changed\" at the bottom.",
+ "path": "docs/ref/request-response.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T16:09:32+00:00"
+ },
+ {
+ "id": 2742518620,
+ "user": "user_3a67c55598c5",
+ "body": "I don't want to increase the scope here, so I'm mostly leaving this as a question for you to react to (not necessarily encouraging you to push these changes just yet).\n\nDid you consider introducing a dictionary mapping content types to default parser classes? I'm trying to imagine the smoothest transition to django/deps#88, and I'm worried we'll need to support this one-off default for this one-off content type.\n\n[USER_REDACTED] and [USER_REDACTED], do either of you have an opinion about this?",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T16:31:25+00:00"
+ },
+ {
+ "id": 2742546592,
+ "user": "user_3a67c55598c5",
+ "body": "I guess we don't want to imply that any other content types are swappable. But there are ways around that, like adding a (silenceable) system check.",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T16:38:22+00:00"
+ },
+ {
+ "id": 2743238626,
+ "user": "user_bddf51c3ef59",
+ "body": "[USER_REDACTED] I think if it were me, I’d be inclined to keep this as it is here, and not try to preempt the future (merely possible) code. \n\n(It’s been so long not coming that I’d not want to tempt fate at this point 🫠)\n\nI think a deprecation path using a descriptor here would be fine (and quite low impact). \n\nWdyt?",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T19:46:44+00:00"
+ },
+ {
+ "id": 2743310706,
+ "user": "user_3a67c55598c5",
+ "body": "That's what I needed to hear!",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-29T20:04:25+00:00"
+ },
+ {
+ "id": 2744841844,
+ "user": "user_bddf51c3ef59",
+ "body": "```suggestion\n # This assertion would FAIL without the multipart_parser_class change\n```",
+ "path": "tests/requests_tests/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T06:33:22+00:00"
+ },
+ {
+ "id": 2746766720,
+ "user": "user_35035b8a218c",
+ "body": "+1 on what Carlton said. https://github.com/[USER_REDACTED]ngo/deps/pull/88 might just rewrite the request altogether (probably not but still), thinking about what might happen sounds like premature optimization",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-30T15:18:35+00:00"
+ },
+ {
+ "id": 2751595940,
+ "user": "user_cb2fc5a53d8e",
+ "body": "Should we document this approach of subclassing `[WSGI|ASGI]Request`? Natalia also mentioned subclassing HttpRequest in the ticket.\n\nhttps://code.djangoproject.com/ticket/36841#comment:2",
+ "path": "tests/requests_tests/tests.py",
+ "line": 1130,
+ "side": "RIGHT",
+ "created_at": "2026-02-01T16:57:29+00:00"
+ },
+ {
+ "id": 2751642108,
+ "user": "user_cb2fc5a53d8e",
+ "body": "Should we make `multi_part_parser` immutable once the body has been parsed? \n\nSay you are setting the parser in a view, and _somewhere_ before then it had already been read you'll get the data that was originally parsed. \n\n``` python\nIn [34]: payload = FakePayload(\n ...: \"\\r\\n\".join(\n ...: [\n ...: \"--boundary\",\n ...: 'Content-Disposition: form-data; name=\"name\"',\n ...: \"\",\n ...: \"value\",\n ...: \"--boundary--\",\n ...: ]\n ...: )\n ...: )\n\nIn [35]: request = WSGIRequest( {\n ...: \"REQUEST_METHOD\": \"POST\",\n ...: \"CONTENT_TYPE\": \"multipart/form-data; boundary=boundary\",\n ...: \"CONTENT_LENGTH\": len(payload),\n ...: \"wsgi.input\": payload,\n ...: }\n ...: )\n\nIn [36]: request.POST\nOut[36]: \n\nIn [32]: class CustomMultiPartParser(MultiPartParser):\n ...: def parse(self):\n ...: files = MultiValueDict()\n ...: return {\"Test\" : 1234}, files\n\nIn [37]: request.multipart_parser_class = [NAME_REDACTED] [38]: request.POST\nOut[38]: # Not the data from our custom parser\n```",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-01T17:20:12+00:00"
+ },
+ {
+ "id": 2751801232,
+ "user": "user_bddf51c3ef59",
+ "body": "I thought about this. I kind of think the middleware approach is more _mainstream_. \n\nI don't think we mention the handler classes (and manually instantiating them) at all do we? \n\n(Like that's probably how _I'd_ do it myself, but is it part of the _public API_ so to speak? Not sure it is.)",
+ "path": "tests/requests_tests/tests.py",
+ "line": 1130,
+ "side": "RIGHT",
+ "created_at": "2026-02-01T18:39:01+00:00"
+ },
+ {
+ "id": 2751802591,
+ "user": "user_bddf51c3ef59",
+ "body": "Nice example. \n\nI'd be inclined to just document something like. \"Setting ... after `request.POST` has already been processed will have no effect.\" \n\n(Phrasing isn't quite right there: the attribute will be set, just not _used_.)",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-01T18:40:58+00:00"
+ },
+ {
+ "id": 2761390011,
+ "user": "user_3a67c55598c5",
+ "body": "Having this as a property from the start might make it easier to cleanly deprecate later 👍",
+ "path": "django/http/request.py",
+ "line": 373,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T22:59:33+00:00"
+ },
+ {
+ "id": 2761395332,
+ "user": "user_3a67c55598c5",
+ "body": "I'd raise `RuntimeError` since I'm used to `AttributeError` emitted on getting missing attrs, not on setting.",
+ "path": "django/http/request.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-03T23:01:01+00:00"
+ },
+ {
+ "id": 2774803751,
+ "user": "user_3a67c55598c5",
+ "body": "Watch out, this snuck in 😄",
+ "path": "uv.lock",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-06T15:50:19+00:00"
+ },
+ {
+ "id": 2774824277,
+ "user": "user_b42982f63633",
+ "body": "Sorry, fixed.",
+ "path": "uv.lock",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-06T15:54:57+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 14,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 17,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 17
+ }
+}
+{
+ "_id": "283059a64f65c251",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20497,
+ "title": "Fixed #36843, #36793 -- Reverted \"Fixed #27489 -- Renamed permissions upon model renaming in migrations.\"",
+ "body": "#### Trac ticket number\nFixes regressions:\nticket-36843\nticket-36793\nOriginal work being reverted:\nticket-27489\n\n#### Branch description\nThis reverts commits f02b49d2f3bf84f5225de920ca510149f1f9f1da and 6e89271a8507fe272d11814975500a1b40303a04.\n\n#20481 outlines some issues that came to light in the `RenamePermission` operation after it was merged. The highest severity issues were captured in Trac, but there is some low priority feedback as well captured in #20481.\n\nThe issue (ticket-36793) dealing with conflict handling is admittedly more niche, but it still deserves some thought (warn? fail? add interactive mode?). I'm suggesting to merge this revert, and then reopen ticket-27489 and address the feedback with less time pressure.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [na] I have added or updated relevant tests.\n- [na] I have added or updated relevant docs, including release notes if applicable.\n- [na] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_3a67c55598c5",
+ "created_at": "2026-01-05T19:18:21+00:00",
+ "merged_at": "2026-01-05T20:45:27+00:00",
+ "base_branch": "main",
+ "head_branch": "jtw/revert-rename-permission",
+ "additions": 12,
+ "deletions": 313,
+ "changed_files": 7,
+ "files": [
+ {
+ "filename": "django/contrib/auth/apps.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 7,
+ "changes": 9,
+ "patch": "@@ -1,12 +1,12 @@\n from django.apps import AppConfig\n from django.core import checks\n from django.db.models.query_utils import DeferredAttribute\n-from django.db.models.signals import post_migrate, pre_migrate\n+from django.db.models.signals import post_migrate\n from django.utils.translation import gettext_lazy as _\n \n from . import get_user_model\n from .checks import check_middleware, check_models_permissions, check_user_model\n-from .management import create_permissions, rename_permissions\n+from .management import create_permissions\n from .signals import user_logged_in\n \n \n@@ -20,11 +20,6 @@ def ready(self):\n create_permissions,\n dispatch_uid=\"django.contrib.auth.management.create_permissions\",\n )\n- pre_migrate.connect(\n- rename_permissions,\n- dispatch_uid=\"django.contrib.auth.management.rename_permissions\",\n- )\n-\n last_login_field = getattr(get_user_model(), \"last_login\", None)\n # Register the handler only if UserModel.last_login is a field.\n if isinstance(last_login_field, DeferredAttribute):"
+ },
+ {
+ "filename": "django/contrib/auth/management/__init__.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 81,
+ "changes": 82,
+ "patch": "@@ -9,9 +9,7 @@\n from django.contrib.auth import get_permission_codename\n from django.contrib.contenttypes.management import create_contenttypes\n from django.core import exceptions\n-from django.db import DEFAULT_DB_ALIAS, migrations, router, transaction\n-from django.db.utils import IntegrityError\n-from django.utils.text import camel_case_to_spaces\n+from django.db import DEFAULT_DB_ALIAS, router\n \n \n def _get_all_permissions(opts):\n@@ -110,84 +108,6 @@ def create_permissions(\n print(\"Adding permission '%s'\" % perm)\n \n \n-class RenamePermission(migrations.RunPython):\n- def __init__(self, app_label, old_model, new_model):\n- self.app_label = app_label\n- self.old_model = old_model\n- self.new_model = new_model\n- super(RenamePermission, self).__init__(\n- self.rename_forward, self.rename_backward\n- )\n-\n- def _rename(self, apps, schema_editor, old_model, new_model):\n- ContentType = apps.get_model(\"contenttypes\", \"ContentType\")\n- # Use the live Permission model instead of the frozen one, since frozen\n- # models do not retain foreign key constraints.\n- from django.contrib.auth.models import Permission\n-\n- db = schema_editor.connection.alias\n- ctypes = ContentType.objects.using(db).filter(\n- app_label=self.app_label, model__icontains=old_model.lower()\n- )\n- for permission in Permission.objects.using(db).filter(\n- content_type_id__in=ctypes.values(\"id\")\n- ):\n- prefix = permission.codename.split(\"_\")[0]\n- default_verbose_name = camel_case_to_spaces(new_model)\n-\n- new_codename = f\"{prefix}_{new_model.lower()}\"\n- new_name = f\"Can {prefix} {default_verbose_name}\"\n-\n- if permission.codename != new_codename or permission.name != new_name:\n- permission.codename = new_codename\n- permission.name = new_name\n- try:\n- with transaction.atomic(using=db):\n- permission.save(update_fields={\"name\", \"codename\"})\n- except IntegrityError:\n- pass\n-\n- def rename_forward(self, apps, schema_editor):\n- self._rename(apps, schema_editor, self.old_model, self.new_model)\n-\n- def rename_backward(self, apps, schema_editor):\n- self._rename(apps, schema_editor, self.new_model, self.old_model)\n-\n-\n-def rename_permissions(\n- plan,\n- verbosity=2,\n- interactive=True,\n- using=DEFAULT_DB_ALIAS,\n- apps=global_apps,\n- **kwargs,\n-):\n- \"\"\"\n- Insert a `RenamePermissionType` operation after every planned `RenameModel`\n- operation.\n- \"\"\"\n- try:\n- Permission = apps.get_model(\"auth\", \"Permission\")\n- except LookupError:\n- return\n- else:\n- if not router.allow_migrate_model(using, Permission):\n- return\n-\n- for migration, backward in plan:\n- inserts = []\n- for index, operation in enumerate(migration.operations):\n- if isinstance(operation, migrations.RenameModel):\n- operation = RenamePermission(\n- migration.app_label,\n- operation.old_name,\n- operation.new_name,\n- )\n- inserts.append((index + 1, operation))\n- for inserted, (index, operation) in enumerate(inserts):\n- migration.operations.insert(inserted + index, operation)\n-\n-\n def get_system_username():\n \"\"\"\n Return the current system user's username, or an empty string if the"
+ },
+ {
+ "filename": "docs/releases/6.0.1.txt",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 0,
+ "changes": 7,
+ "patch": "@@ -42,3 +42,10 @@ Bugfixes\n * Fixed a regression in Django 6.0 where the :attr:`.Widget.use_fieldset`\n attribute of :class:`~django.forms.ClearableFileInput` was flipped\n from ``False`` to ``True`` (:ticket:`36829`).\n+\n+* Reverted an undocumented optimization in Django 6.0 that modified permission\n+ :attr:`~django.contrib.auth.models.Permission.name` and\n+ :attr:`~django.contrib.auth.models.Permission.codename` values when renaming\n+ models via a migration. This change could affect unrelated\n+ :class:`~django.contrib.auth.models.Permission` objects (:ticket:`36843`) and\n+ did not report conflicts (:ticket:`36793`)."
+ },
+ {
+ "filename": "tests/auth_tests/operations_migrations/0001_initial.py",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 14,
+ "changes": 14,
+ "patch": "@@ -1,14 +0,0 @@\n-from django.db import migrations, models\n-\n-\n-class Migration(migrations.Migration):\n- initial = True\n-\n- operations = [\n- migrations.CreateModel(\n- name=\"OldModel\",\n- fields=[\n- (\"id\", models.AutoField(primary_key=True)),\n- ],\n- ),\n- ]"
+ },
+ {
+ "filename": "tests/auth_tests/operations_migrations/0002_rename_oldmodel_to_newmodel.py",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 14,
+ "changes": 14,
+ "patch": "@@ -1,14 +0,0 @@\n-from django.db import migrations\n-\n-\n-class Migration(migrations.Migration):\n- dependencies = [\n- (\"auth_tests\", \"0001_initial\"),\n- ]\n-\n- operations = [\n- migrations.RenameModel(\n- old_name=\"OldModel\",\n- new_name=\"NewModel\",\n- ),\n- ]"
+ },
+ {
+ "filename": "tests/auth_tests/operations_migrations/__init__.py",
+ "status": "removed",
+ "additions": 0,
+ "deletions": 0,
+ "changes": 0,
+ "patch": null
+ },
+ {
+ "filename": "tests/auth_tests/test_management.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 197,
+ "changes": 199,
+ "patch": "@@ -7,21 +7,15 @@\n from unittest import mock\n \n from django.apps import apps\n-from django.conf import settings\n from django.contrib.auth import get_permission_codename, management\n-from django.contrib.auth.management import (\n- RenamePermission,\n- create_permissions,\n- get_default_username,\n-)\n+from django.contrib.auth.management import create_permissions, get_default_username\n from django.contrib.auth.management.commands import changepassword, createsuperuser\n from django.contrib.auth.models import Group, Permission, User\n from django.contrib.contenttypes.models import ContentType\n from django.core.management import call_command\n from django.core.management.base import CommandError\n-from django.db import migrations, models\n+from django.db import migrations\n from django.test import TestCase, override_settings\n-from django.test.testcases import TransactionTestCase\n from django.utils.translation import gettext_lazy as _\n \n from .models import (\n@@ -1534,195 +1528,6 @@ def test_permission_with_proxy_content_type_created(self):\n )\n \n \n-[USER_REDACTED]_settings(\n- MIGRATION_MODULES=dict(\n- settings.MIGRATION_MODULES,\n- auth_tests=\"auth_tests.operations_migrations\",\n- ),\n-)\n-class PermissionRenameOperationsTests(TransactionTestCase):\n- available_apps = [\n- \"django.contrib.contenttypes\",\n- \"django.contrib.auth\",\n- \"auth_tests\",\n- ]\n- databases = {\"default\", \"other\"}\n-\n- def setUp(self):\n- app_config = apps.get_app_config(\"auth_tests\")\n- models.signals.post_migrate.connect(\n- self.assertOperationsInjected, sender=app_config\n- )\n- self.addCleanup(\n- models.signals.post_migrate.disconnect,\n- self.assertOperationsInjected,\n- sender=app_config,\n- )\n-\n- def assertOperationsInjected(self, plan, **kwargs):\n- for migration, _backward in plan:\n- operations = iter(migration.operations)\n- for operation in operations:\n- if isinstance(operation, migrations.RenameModel):\n- next_operation = next(operations)\n- self.assertIsInstance(next_operation, RenamePermission)\n- self.assertEqual(next_operation.app_label, migration.app_label)\n- self.assertEqual(next_operation.old_model, operation.old_name)\n- self.assertEqual(next_operation.new_model, operation.new_name)\n-\n- def test_permission_rename(self):\n- ct = ContentType.objects.create(app_label=\"auth_tests\", model=\"oldmodel\")\n- actions = [\"add\", \"change\", \"delete\", \"view\"]\n- for action in actions:\n- Permission.objects.create(\n- codename=f\"{action}_oldmodel\",\n- name=f\"Can {action} old model\",\n- content_type=ct,\n- )\n-\n- call_command(\"migrate\", \"auth_tests\", verbosity=0)\n- for action in actions:\n- self.assertFalse(\n- Permission.objects.filter(codename=f\"{action}_oldmodel\").exists()\n- )\n- self.assertTrue(\n- Permission.objects.filter(codename=f\"{action}_newmodel\").exists()\n- )\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- \"zero\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n-\n- for action in actions:\n- self.assertTrue(\n- Permission.objects.filter(codename=f\"{action}_oldmodel\").exists()\n- )\n- self.assertFalse(\n- Permission.objects.filter(codename=f\"{action}_newmodel\").exists()\n- )\n-\n- def test_permission_rename_other_db(self):\n- ct = ContentType.objects.using(\"default\").create(\n- app_label=\"auth_tests\", model=\"oldmodel\"\n- )\n- permission = Permission.objects.using(\"default\").create(\n- codename=\"add_oldmodel\",\n- name=\"Can add old model\",\n- content_type=ct,\n- )\n- # RenamePermission respects the database.\n- call_command(\"migrate\", \"auth_tests\", verbosity=0, database=\"other\")\n- permission.refresh_from_db()\n- self.assertEqual(permission.codename, \"add_oldmodel\")\n- self.assertFalse(\n- Permission.objects.using(\"other\").filter(codename=\"add_oldmodel\").exists()\n- )\n- self.assertTrue(\n- Permission.objects.using(\"other\").filter(codename=\"add_newmodel\").exists()\n- )\n-\n- [USER_REDACTED].patch(\n- \"django.db.router.allow_migrate_model\",\n- return_value=False,\n- )\n- def test_rename_skipped_if_router_disallows(self, _):\n- ct = ContentType.objects.create(app_label=\"auth_tests\", model=\"oldmodel\")\n- Permission.objects.create(\n- codename=\"change_oldmodel\",\n- name=\"Can change old model\",\n- content_type=ct,\n- )\n- # The rename operation should not be there when disallowed by router.\n- app_config = apps.get_app_config(\"auth_tests\")\n- models.signals.post_migrate.disconnect(\n- self.assertOperationsInjected, sender=app_config\n- )\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n- self.assertTrue(Permission.objects.filter(codename=\"change_oldmodel\").exists())\n- self.assertFalse(Permission.objects.filter(codename=\"change_newmodel\").exists())\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- \"zero\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n-\n- def test_rename_backward_does_nothing_if_no_permissions(self):\n- Permission.objects.filter(content_type__app_label=\"auth_tests\").delete()\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- \"zero\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n- self.assertFalse(\n- Permission.objects.filter(\n- codename__in=[\"change_oldmodel\", \"change_newmodel\"]\n- ).exists()\n- )\n-\n- def test_rename_permission_conflict(self):\n- ct = ContentType.objects.create(app_label=\"auth_tests\", model=\"oldmodel\")\n- Permission.objects.create(\n- codename=\"change_newmodel\",\n- name=\"Can change new model\",\n- content_type=ct,\n- )\n- Permission.objects.create(\n- codename=\"change_oldmodel\",\n- name=\"Can change old model\",\n- content_type=ct,\n- )\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n- self.assertTrue(\n- Permission.objects.filter(\n- codename=\"change_oldmodel\",\n- name=\"Can change old model\",\n- ).exists()\n- )\n- self.assertEqual(\n- Permission.objects.filter(\n- codename=\"change_newmodel\",\n- name=\"Can change new model\",\n- ).count(),\n- 1,\n- )\n-\n- call_command(\n- \"migrate\",\n- \"auth_tests\",\n- \"zero\",\n- database=\"default\",\n- interactive=False,\n- verbosity=0,\n- )\n-\n-\n class DefaultDBRouter:\n \"\"\"Route all writes to default.\"\"\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3628192809,
+ "user": "user_00dac951cdbf",
+ "state": "APPROVED",
+ "body": "Looks good, thank you for the thorough code digging and analysis!\n\nI suggested a few optional changes for the release note.",
+ "submitted_at": "2026-01-05T19:43:58+00:00"
+ },
+ {
+ "id": 3628199901,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-05T19:45:53+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2662608672,
+ "user": "user_00dac951cdbf",
+ "body": "Suggestion to make it clear that the rename is on the values of the fields, not the field names (which is how I read it originally):\n\n```suggestion\n* Reverted an undocumented optimization in Django 6.0 that modified permission\n :attr:`~django.contrib.auth.models.Permission.name` and\n :attr:`~django.contrib.auth.models.Permission.codename` values when renaming\n models via a migration. This change could affect unrelated\n :class:`~django.contrib.auth.models.Permission` objects (:ticket:`36843`) and\n did not report conflicts (:ticket:`36793`).\n```",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T19:43:06+00:00"
+ },
+ {
+ "id": 2662614840,
+ "user": "user_3a67c55598c5",
+ "body": "Nice catch 👍",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T19:45:53+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "24dfbe178a6db06e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20496,
+ "title": "Improve `django.tasks.base` types",
+ "body": "`list` does not provide as much information as `list[Any]`, since args can literally be `Any`, there's no need to ignore this type.\n\nThis is a minor cleanup, I don't think that it needs an issue.\nFound while working on `django-stubs` support for `django.tasks`: https://github.com/[USER_REDACTED]ngo/django-stubs/pull/2967",
+ "author": "user_8c6bac8ba940",
+ "created_at": "2026-01-05T10:36:02+00:00",
+ "merged_at": "2026-01-07T15:23:26+00:00",
+ "base_branch": "main",
+ "head_branch": "patch-6",
+ "additions": 11,
+ "deletions": 10,
+ "changed_files": 1,
+ "files": [
+ {
+ "filename": "django/tasks/base.py",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 10,
+ "changes": 21,
+ "patch": "@@ -1,7 +1,8 @@\n+from collections.abc import Callable\n from dataclasses import dataclass, field, replace\n from datetime import datetime\n from inspect import isclass, iscoroutinefunction\n-from typing import Any, Callable, Dict, Optional\n+from typing import Any\n \n from asgiref.sync import async_to_sync, sync_to_async\n \n@@ -43,10 +44,10 @@ class TaskResultStatus(TextChoices):\n [USER_REDACTED](frozen=True, slots=True, kw_only=True)\n class Task:\n priority: int\n- func: Callable # The Task function.\n+ func: Callable[..., Any] # The Task function.\n backend: str\n queue_name: str\n- run_after: Optional[datetime] # The earliest this Task will run.\n+ run_after: datetime | None # The earliest this Task will run.\n \n # Whether the Task receives the Task context when executed.\n takes_context: bool = False\n@@ -180,20 +181,20 @@ class TaskResult:\n \n id: str # Unique identifier for the task result.\n status: TaskResultStatus\n- enqueued_at: Optional[datetime] # Time the task was enqueued.\n- started_at: Optional[datetime] # Time the task was started.\n- finished_at: Optional[datetime] # Time the task was finished.\n+ enqueued_at: datetime | None # Time the task was enqueued.\n+ started_at: datetime | None # Time the task was started.\n+ finished_at: datetime | None # Time the task was finished.\n \n # Time the task was last attempted to be run.\n- last_attempted_at: Optional[datetime]\n+ last_attempted_at: datetime | None\n \n- args: list # Arguments to pass to the task function.\n- kwargs: Dict[str, Any] # Keyword arguments to pass to the task function.\n+ args: list[Any] # Arguments to pass to the task function.\n+ kwargs: dict[str, Any] # Keyword arguments to pass to the task function.\n backend: str\n errors: list[TaskError] # Errors raised when running the task.\n worker_ids: list[str] # Workers which have processed the task.\n \n- _return_value: Optional[Any] = field(init=False, default=None)\n+ _return_value: Any | None = field(init=False, default=None)\n \n def __post_init__(self):\n object.__setattr__(self, \"args\", normalize_json(self.args))"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3626655469,
+ "user": "user_34c3f4acb8a8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-05T12:27:40+00:00"
+ },
+ {
+ "id": 3627856788,
+ "user": "user_194c2ef4033e",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-05T17:54:07+00:00"
+ },
+ {
+ "id": 3630539919,
+ "user": "user_194c2ef4033e",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-06T11:20:12+00:00"
+ },
+ {
+ "id": 3631243615,
+ "user": "user_c332d334e171",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-01-06T15:01:27+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2661333487,
+ "user": "user_34c3f4acb8a8",
+ "body": "Question: is `list` not just a shorthand for `list[Any]`? Does this improve the type signature at all?",
+ "path": "django/tasks/base.py",
+ "line": 191,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T12:27:40+00:00"
+ },
+ {
+ "id": 2662329817,
+ "user": "user_194c2ef4033e",
+ "body": "Implicitly, yes, but it's often helpful to be explicit.\n\nIn addition, when enabling mypy's [`--disallow-any-generics`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-disallow-any-generics), which is included when using the [`--strict`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict) flag, implicit type parameters will error.",
+ "path": "django/tasks/base.py",
+ "line": 191,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T17:50:24+00:00"
+ },
+ {
+ "id": 2662339442,
+ "user": "user_194c2ef4033e",
+ "body": "As Django 6.0+ targets Python 3.12+ we can make the following change:\n\n```diff\n-from typing import Any, Callable, Dict, Optional\n+from collections.abc import Callable\n+from typing import Any\n```\n\nAnd below we should change the following:\n\n- Instead of `typing.Dict[K, V]` we can use `dict[K, V]`. (We're already using `list` instead of `typing.List`.)\n- Instead of `typing.Optional[T]` we can use `T | None`.",
+ "path": "django/tasks/base.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T17:53:45+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 3,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 3
+ }
+}
+{
+ "_id": "c5e4a3af7ce7d4ed",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20495,
+ "title": "Fixed #35442 -- Prevented N+1 queries in RelatedManager with only().",
+ "body": "ticket-35442\n\n#### Branch description\nThis PR prevents N+1 queries when iterating over a `RelatedManager` queryset that uses `.only()` to exclude the foreign key field.\n\nPreviously, `ModelIterable` would attempt to optimize the relationship population by [NAME_REDACTED] on the child object. If that key was deferred (via .`only()`), accessing it triggered an immediate SQL query for every row.\n\nThe fix modifies `ModelIterable` to check `obj.__dict__` first. If the foreign key attributes are missing (deferred), the optimization is skipped, preserving the lazy loading behavior requested by [NAME_REDACTED]\n\n**Tests:**\n* Added `test_only_related_manager_optimization` in `defer.tests` to verify query count is 1 (previously N+1).\n* Updated `defer.tests.DeferTests.test_only` to assert the correct number of deferred fields (3 instead of 2), reflecting that the foreign key is now correctly deferred.\n\n#### Checklist\n- [ ] This PR targets the `main` branch. \n- [ ] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [ ] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_97513ac81384",
+ "created_at": "2026-01-05T05:51:48+00:00",
+ "merged_at": "2026-01-13T18:18:14+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-35442-clean",
+ "additions": 26,
+ "deletions": 14,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/db/models/query.py",
+ "status": "modified",
+ "additions": 14,
+ "deletions": 11,
+ "changes": 25,
+ "patch": "@@ -109,16 +109,15 @@ def __iter__(self):\n (\n field,\n related_objs,\n- operator.attrgetter(\n- *[\n- (\n- field.attname\n- if from_field == \"self\"\n- else queryset.model._meta.get_field(from_field).attname\n- )\n- for from_field in field.from_fields\n- ]\n- ),\n+ attnames := [\n+ (\n+ field.attname\n+ if from_field == \"self\"\n+ else queryset.model._meta.get_field(from_field).attname\n+ )\n+ for from_field in field.from_fields\n+ ],\n+ operator.attrgetter(*attnames),\n )\n for field, related_objs in queryset._known_related_objects.items()\n ]\n@@ -133,10 +132,14 @@ def __iter__(self):\n setattr(obj, attr_name, row[col_pos])\n \n # Add the known related objects to the model.\n- for field, rel_objs, rel_getter in known_related_objects:\n+ for field, rel_objs, rel_attnames, rel_getter in known_related_objects:\n # Avoid overwriting objects loaded by, e.g., select_related().\n if field.is_cached(obj):\n continue\n+ # Avoid fetching potentially deferred attributes that would\n+ # result in unexpected queries.\n+ if any(attname not in obj.__dict__ for attname in rel_attnames):\n+ continue\n rel_obj_id = rel_getter(obj)\n try:\n rel_obj = rel_objs[rel_obj_id]"
+ },
+ {
+ "filename": "tests/defer/tests.py",
+ "status": "modified",
+ "additions": 12,
+ "deletions": 3,
+ "changes": 15,
+ "patch": "@@ -47,9 +47,9 @@ def test_only(self):\n # of them except the model's primary key see #15494\n self.assert_delayed(qs.only(\"pk\")[0], 3)\n # You can use 'pk' with reverse foreign key lookups.\n- # The related_id is always set even if it's not fetched from the DB,\n- # so pk and related_id are not deferred.\n- self.assert_delayed(self.s1.primary_set.only(\"pk\")[0], 2)\n+ # The related_id is not set if it's not fetched from the DB,\n+ # so pk is not deferred, but related_id is.\n+ self.assert_delayed(self.s1.primary_set.only(\"pk\")[0], 3)\n \n def test_defer_only_chaining(self):\n qs = Primary.objects.all()\n@@ -82,6 +82,15 @@ def test_only_none_raises_error(self):\n with self.assertRaisesMessage(TypeError, msg):\n Primary.objects.only(None)\n \n+ def test_only_related_manager_optimization(self):\n+ s = Secondary.objects.create(first=\"one\", second=\"two\")\n+ Primary.objects.bulk_create(\n+ [Primary(name=\"p1\", value=\"v1\", related=s) for _ in range(5)]\n+ )\n+ with self.assertNumQueries(1):\n+ for p in s.primary_set.only(\"pk\"):\n+ _ = p.pk\n+\n def test_defer_extra(self):\n qs = Primary.objects.all()\n self.assert_delayed(qs.defer(\"name\").extra(select={\"a\": 1})[0], 1)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3627364454,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks for the PR! Since this uses Simon's patch from the ticket comments, please add him as a co-author [NAME_REDACTED] You can grep the commit log to see how this is done. Also please use two hyphens (not one) in the commit message & PR title. Cheers!",
+ "submitted_at": "2026-01-05T15:42:38+00:00"
+ },
+ {
+ "id": 3652397706,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks 👍",
+ "submitted_at": "2026-01-12T19:39:18+00:00"
+ },
+ {
+ "id": 3652611214,
+ "user": "user_97513ac81384",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T20:21:44+00:00"
+ },
+ {
+ "id": 3652903933,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks ⭐",
+ "submitted_at": "2026-01-12T21:58:56+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2683613011,
+ "user": "user_3a67c55598c5",
+ "body": "Shouldn't this comment be updated?",
+ "path": "tests/defer/tests.py",
+ "line": 52,
+ "side": "LEFT",
+ "created_at": "2026-01-12T19:32:57+00:00"
+ },
+ {
+ "id": 2683789910,
+ "user": "user_97513ac81384",
+ "body": "I will update it now.",
+ "path": "tests/defer/tests.py",
+ "line": 52,
+ "side": "LEFT",
+ "created_at": "2026-01-12T20:21:44+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 3,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "2801ff2d744d57b3",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20480,
+ "title": "Refs #33647 -- Fixed silent data truncation in bulk_create on Postgres.",
+ "body": "#### Trac ticket number\nticket-33647\n\n#### Branch description\nRegression in a16eedcf9c69d8a11d94cac1811018c5b996d491.\n\nThe UNNEST strategy is affected by [NAME_REDACTED]_update has wrt/ to silent data truncation due to its usage of db_type which always returns a parametrized subtype.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_3a67c55598c5",
+ "created_at": "2025-12-31T15:12:16+00:00",
+ "merged_at": "2025-12-31T15:41:55+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-33647",
+ "additions": 22,
+ "deletions": 3,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/db/backends/postgresql/compiler.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -53,7 +53,9 @@ def assemble_as_sql(self, fields, value_rows):\n or any(any(hasattr(value, \"as_sql\") for value in row) for row in value_rows)\n ):\n return super().assemble_as_sql(fields, value_rows)\n- db_types = [field.db_type(self.connection) for field in fields]\n+ # Manually remove parameters from `db_type` to ensure no data\n+ # truncation takes place (e.g. varchar[] instead of varchar(50)[]).\n+ db_types = [field.db_type(self.connection).split(\"(\")[0] for field in fields]\n return InsertUnnest([\"(%%s)::%s[]\" % db_type for db_type in db_types]), [\n list(map(list, zip(*value_rows)))\n ]"
+ },
+ {
+ "filename": "docs/releases/5.2.10.txt",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 1,
+ "changes": 6,
+ "patch": "@@ -4,11 +4,15 @@ Django 5.2.10 release notes\n \n *[NAME_REDACTED] 6, 2026*\n \n-Django 5.2.10 fixes several bugs in 5.2.9.\n+Django 5.2.10 fixes a data loss bug in Django 5.2 and one bug related to\n+support for Python 3.14.\n \n Bugfixes\n ========\n \n+* Fixed a bug in Django 5.2 where data exceeding ``max_length`` was silently\n+ truncated by :meth:`.QuerySet.bulk_create` on PostgreSQL (:ticket:`33647`).\n+\n * Fixed a bug where management command colorized help (introduced in\n Python 3.14) ignored the :option:`--no-color` option and the\n :envvar:`DJANGO_COLORS` setting (:ticket:`36376`)."
+ },
+ {
+ "filename": "docs/releases/6.0.1.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 1,
+ "changes": 5,
+ "patch": "@@ -4,11 +4,14 @@ Django 6.0.1 release notes\n \n *[NAME_REDACTED] 6, 2026*\n \n-Django 6.0.1 fixes several bugs in 6.0.\n+Django 6.0.1 fixes one data loss bug in Django 5.2 and several bugs in 6.0.\n \n Bugfixes\n ========\n \n+* Fixed a bug in Django 5.2 where data exceeding ``max_length`` was silently\n+ truncated by :meth:`.QuerySet.bulk_create` on PostgreSQL (:ticket:`33647`).\n+\n * Fixed a regression in Django 6.0 where :ttag:`querystring` mishandled\n multi-value :class:`~django.http.QueryDict` keys, both by [NAME_REDACTED] value and by [NAME_REDACTED] ``None`` values (:ticket:`36783`)."
+ },
+ {
+ "filename": "tests/backends/postgresql/test_compilation.py",
+ "status": "modified",
+ "additions": 10,
+ "deletions": 0,
+ "changes": 10,
+ "patch": "@@ -3,6 +3,7 @@\n \n from django.db import connection\n from django.db.models.expressions import RawSQL\n+from django.db.utils import DataError\n from django.test import TestCase\n \n from ..models import Article, Reporter, Square\n@@ -48,3 +49,12 @@ def test_unnest_eligible_foreign_keys(self):\n self.assertEqual(\n [article.reporter for article in articles], [reporter, reporter]\n )\n+\n+ def test_parametrized_db_type(self):\n+ with self.assertRaises(DataError):\n+ Reporter.objects.bulk_create(\n+ [\n+ Reporter(),\n+ Reporter(first_name=\"a\" * 31),\n+ ]\n+ )"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3621043169,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-31T15:18:09+00:00"
+ },
+ {
+ "id": 3621046730,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-31T15:21:04+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2655539830,
+ "user": "user_cdda8932ec17",
+ "body": "FWIW the bug is also present for other pamametrized types such as `DecimalField`\n\nhttps://github.com/[USER_REDACTED]ngo/django/blob/79ab0993d0f2253e10ea638bcefc98ec2d890a47/django/db/backends/postgresql/base.py#L111-L114",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-31T15:18:08+00:00"
+ },
+ {
+ "id": 2655543452,
+ "user": "user_3a67c55598c5",
+ "body": "Right, I was just trying to render a link. Should I just render a code literal?",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-31T15:21:03+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": false,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "3cec6bef9f1864a8",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20471,
+ "title": "Fixed #36829 -- Revert unintended ClearableFileInput.use_fieldset change",
+ "body": "#### Trac ticket number\n\nticket-36829\nRef 4187da2\n\n#### Branch description\n\nRevert undocumented flip of `ClearableFileInput.use_fieldset` in Django 6.0.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_eb9e19005079",
+ "created_at": "2025-12-27T11:32:11+00:00",
+ "merged_at": "2025-12-31T15:14:00+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket/36829/fieldset",
+ "additions": 13,
+ "deletions": 9,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/contrib/admin/widgets.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -122,6 +122,7 @@ class AdminRadioSelect(forms.RadioSelect):\n \n class AdminFileWidget(forms.ClearableFileInput):\n template_name = \"admin/widgets/clearable_file_input.html\"\n+ use_fieldset = True\n \n \n def url_params_from_lookup_dict(lookups):"
+ },
+ {
+ "filename": "django/forms/widgets.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -530,7 +530,7 @@ class ClearableFileInput(FileInput):\n input_text = _(\"Change\")\n template_name = \"django/forms/widgets/clearable_file_input.html\"\n checked = False\n- use_fieldset = True\n+ use_fieldset = False\n \n def clear_checkbox_name(self, name):\n \"\"\""
+ },
+ {
+ "filename": "docs/releases/6.0.1.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -35,3 +35,7 @@ Bugfixes\n * Fixed a regression in Django 6.0 where :func:`~django.urls.path` routes\n defined using :func:`~django.utils.translation.gettext_lazy` failed to\n resolve correctly (:ticket:`36796`).\n+\n+* Fixed a regression in Django 6.0 where the :attr:`.Widget.use_fieldset`\n+ attribute of :class:`~django.forms.ClearableFileInput` was flipped\n+ from ``False`` to ``True`` (:ticket:`36829`)."
+ },
+ {
+ "filename": "tests/forms_tests/widget_tests/test_clearablefileinput.py",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 8,
+ "changes": 15,
+ "patch": "@@ -246,19 +246,18 @@ class TestForm(Form):\n )\n \n form = TestForm()\n- self.assertIs(self.widget.use_fieldset, True)\n+ self.assertIs(self.widget.use_fieldset, False)\n self.assertHTMLEqual(\n- \"
Field: \"\n- ' '\n- \"',\n form.render(),\n )"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3620924815,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-31T14:03:06+00:00"
+ },
+ {
+ "id": 3620964633,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks for the report and fix!",
+ "submitted_at": "2025-12-31T14:13:17+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2649172415,
+ "user": "user_5e63c02707a8",
+ "body": "The AdminFileWidget class now explicitly sets use_fieldset to True, but there's no test coverage to verify this attribute value. Since the base ClearableFileInput has test coverage for use_fieldset in test_clearablefileinput.py, consider adding a similar test for AdminFileWidget to prevent future regressions of this attribute.",
+ "path": "django/contrib/admin/widgets.py",
+ "line": 125,
+ "side": "RIGHT",
+ "created_at": "2025-12-27T14:49:03+00:00"
+ },
+ {
+ "id": 2655423077,
+ "user": "user_3a67c55598c5",
+ "body": "I'll revert the changes to this file, as the admin's rendering of file fields with a `` was already covered in `test_use_fieldset_fields_render()`:\n```py\n======================================================================\nFAIL: test_use_fieldset_fields_render (admin_views.tests.SeleniumTests.test_use_fieldset_fields_render)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/Users/jwalls/django/tests/admin_views/tests.py\", line 6960, in test_use_fieldset_fields_render\n self.assertEqual(legend.text, expected_legend_tags_text[index])\n ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError: 'Difficulty:' != 'Materials:'\n- Difficulty:\n+ Materials:\n\n----------------------------------------------------------------------\nRan 1 test in 10.571s\n```",
+ "path": "tests/admin_widgets/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-31T13:43:04+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 1,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "57357072f8637ce5",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20466,
+ "title": "Fixed #36639 -- Added CI step to run makemigrations --check against test models.",
+ "body": "#### Trac ticket number\n\n\nticket-36639\n\n#### Branch description\nThis PR automated migration consistency checks for the test models with current migrations and added missing migration files . \nI have tested this PR on my local with \"act\" package.\n\nSS before fixing migrations: \n \n\nSS after fixing migrations:\n \n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_f5eee7dbaa84",
+ "created_at": "2025-12-25T19:07:03+00:00",
+ "merged_at": "2026-01-20T15:40:53+00:00",
+ "base_branch": "main",
+ "head_branch": "fix36639",
+ "additions": 229,
+ "deletions": 14,
+ "changed_files": 7,
+ "files": [
+ {
+ "filename": ".github/workflows/check-migrations.yml",
+ "status": "added",
+ "additions": 68,
+ "deletions": 0,
+ "changes": 68,
+ "patch": "@@ -0,0 +1,68 @@\n+name: Check migrations\n+\n+on:\n+ pull_request:\n+ paths:\n+ - 'tests/**/models.py'\n+ - 'tests/**/migrations/**'\n+ - 'tests/**/*migrations/**/*.py'\n+ - 'scripts/check_migrations.py'\n+ push:\n+ branches:\n+ - main\n+\n+concurrency:\n+ group: ${{ github.workflow }}-${{ github.ref }}\n+ cancel-in-progress: true\n+\n+permissions:\n+ contents: read\n+\n+jobs:\n+ check-migrations:\n+ name: Check test migrations\n+ runs-on: ubuntu-latest\n+ timeout-minutes: 60\n+\n+ services:\n+ postgres:\n+ image: postgres:15-alpine\n+ env:\n+ POSTGRES_DB: django\n+ POSTGRES_USER: user\n+ POSTGRES_PASSWORD: postgres\n+ ports:\n+ - 5432:5432\n+ options: >-\n+ --health-cmd pg_isready\n+ --health-interval 10s\n+ --health-timeout 5s\n+ --health-retries 5\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v6\n+ with:\n+ persist-credentials: false\n+\n+ - name: Set up Python\n+ uses: actions/setup-python@v6\n+ with:\n+ python-version: '3.14'\n+ cache: 'pip'\n+ cache-dependency-path: 'tests/requirements/py3.txt'\n+\n+ - name: Install dependencies\n+ run: |\n+ python -m pip install --upgrade pip wheel\n+ python -m pip install -e . psycopg[binary]\n+\n+ - name: [NAME_REDACTED] settings file\n+ run: mv ./.github/workflows/data/test_postgres.py.tpl ./tests/test_postgres.py\n+\n+ - name: Check for missing migrations\n+ env:\n+ DJANGO_SETTINGS_MODULE: test_postgres\n+ PYTHONPATH: ${{ github.workspace }}/tests:${{ github.workspace }}\n+ run: |\n+ python scripts/check_migrations.py"
+ },
+ {
+ "filename": "scripts/check_migrations.py",
+ "status": "added",
+ "additions": 31,
+ "deletions": 0,
+ "changes": 31,
+ "patch": "@@ -0,0 +1,31 @@\n+import sys\n+from pathlib import Path\n+\n+\n+def main():\n+ repo_root = Path(__file__).resolve().parent.parent\n+ sys.path[:0] = [str(repo_root / \"tests\"), str(repo_root)]\n+\n+ from runtests import ALWAYS_INSTALLED_APPS, get_apps_to_install, get_test_modules\n+\n+ import django\n+ from django.apps import apps\n+ from django.core.management import call_command\n+\n+ django.setup()\n+\n+ test_modules = list(get_test_modules(gis_enabled=False))\n+ installed_apps = list(ALWAYS_INSTALLED_APPS)\n+ for app in get_apps_to_install(test_modules):\n+ # Check against the list to prevent duplicate errors.\n+ if app not in installed_apps:\n+ installed_apps.append(app)\n+ apps.set_installed_apps(installed_apps)\n+\n+ # Note: We don't use check=True here because --check calls sys.exit(1)\n+ # instead of raising CommandError when migrations are missing.\n+ call_command(\"makemigrations\", \"--check\", verbosity=3)\n+\n+\n+if __name__ == \"__main__\":\n+ main()"
+ },
+ {
+ "filename": "tests/db_functions/migrations/0002_create_test_models.py",
+ "status": "modified",
+ "additions": 72,
+ "deletions": 0,
+ "changes": 72,
+ "patch": "@@ -10,6 +10,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"Author\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"name\", models.CharField(max_length=50)),\n (\"alias\", models.CharField(max_length=50, null=True, blank=True)),\n (\"goes_by\", models.CharField(max_length=50, null=True, blank=True)),\n@@ -19,6 +28,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"Article\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\n \"authors\",\n models.ManyToManyField(\n@@ -37,6 +55,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"Fan\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"name\", models.CharField(max_length=50)),\n (\"age\", models.PositiveSmallIntegerField(default=30)),\n (\n@@ -51,6 +78,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"DTModel\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"name\", models.CharField(max_length=32)),\n (\"start_datetime\", models.DateTimeField(null=True, blank=True)),\n (\"end_datetime\", models.DateTimeField(null=True, blank=True)),\n@@ -64,6 +100,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"DecimalModel\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"n1\", models.DecimalField(decimal_places=2, max_digits=6)),\n (\n \"n2\",\n@@ -76,6 +121,15 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"IntegerModel\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"big\", models.BigIntegerField(null=True, blank=True)),\n (\"normal\", models.IntegerField(null=True, blank=True)),\n (\"small\", models.SmallIntegerField(null=True, blank=True)),\n@@ -84,13 +138,31 @@ class Migration(migrations.Migration):\n migrations.CreateModel(\n name=\"FloatModel\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"f1\", models.FloatField(null=True, blank=True)),\n (\"f2\", models.FloatField(null=True, blank=True)),\n ],\n ),\n migrations.CreateModel(\n name=\"UUIDModel\",\n fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n (\"uuid\", models.UUIDField(null=True)),\n (\"shift\", models.DurationField(null=True)),\n ],"
+ },
+ {
+ "filename": "tests/gis_tests/rasterapp/migrations/0002_rastermodels.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -14,7 +14,7 @@ class Migration(migrations.Migration):\n fields=[\n (\n \"id\",\n- models.AutoField(\n+ models.BigAutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,\n@@ -49,7 +49,7 @@ class Migration(migrations.Migration):\n fields=[\n (\n \"id\",\n- models.AutoField(\n+ models.BigAutoField(\n auto_created=True,\n primary_key=True,\n serialize=False,"
+ },
+ {
+ "filename": "tests/migration_test_data_persistence/migrations/0002_add_book.py",
+ "status": "modified",
+ "additions": 26,
+ "deletions": 1,
+ "changes": 27,
+ "patch": "@@ -1,4 +1,4 @@\n-from django.db import migrations\n+from django.db import migrations, models\n \n \n def add_book(apps, schema_editor):\n@@ -16,4 +16,29 @@ class Migration(migrations.Migration):\n migrations.RunPython(\n add_book,\n ),\n+ migrations.CreateModel(\n+ name=\"Unmanaged\",\n+ fields=[\n+ (\n+ \"id\",\n+ models.BigAutoField(\n+ auto_created=True,\n+ primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n+ ),\n+ ),\n+ (\"title\", models.CharField(max_length=100)),\n+ ],\n+ options={\n+ \"managed\": False,\n+ },\n+ ),\n+ migrations.AlterField(\n+ model_name=\"book\",\n+ name=\"id\",\n+ field=models.BigAutoField(\n+ auto_created=True, primary_key=True, serialize=False, verbose_name=\"ID\"\n+ ),\n+ ),\n ]"
+ },
+ {
+ "filename": "tests/postgres_tests/migrations/0002_create_test_models.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -108,7 +108,7 @@ class Migration(migrations.Migration):\n (\"tags\", ArrayField(TagField(), blank=True, null=True)),\n (\n \"json\",\n- ArrayField(models.JSONField(default=dict), default=list),\n+ ArrayField(models.JSONField(default=dict), default=list, null=True),\n ),\n (\"int_ranges\", ArrayField(IntegerRangeField(), null=True, blank=True)),\n (\n@@ -179,7 +179,7 @@ class Migration(migrations.Migration):\n ),\n (\n \"field\",\n- ArrayField(models.FloatField(), size=2, null=True, blank=True),\n+ ArrayField(models.FloatField(), size=3),\n ),\n ],\n options={"
+ },
+ {
+ "filename": "tests/sites_framework/migrations/0001_initial.py",
+ "status": "modified",
+ "additions": 28,
+ "deletions": 9,
+ "changes": 37,
+ "patch": "@@ -1,3 +1,5 @@\n+import django.contrib.sites.managers\n+import django.db.models.manager\n from django.db import migrations, models\n \n \n@@ -12,11 +14,11 @@ class Migration(migrations.Migration):\n fields=[\n (\n \"id\",\n- models.AutoField(\n- verbose_name=\"ID\",\n- serialize=False,\n+ models.BigAutoField(\n auto_created=True,\n primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n ),\n ),\n (\"title\", models.CharField(max_length=50)),\n@@ -28,18 +30,27 @@ class Migration(migrations.Migration):\n options={\n \"abstract\": False,\n },\n+ managers=[\n+ (\"objects\", django.db.models.manager.Manager()),\n+ (\n+ \"on_site\",\n+ django.contrib.sites.managers.CurrentSiteManager(\n+ \"places_this_article_should_appear\"\n+ ),\n+ ),\n+ ],\n bases=(models.Model,),\n ),\n migrations.CreateModel(\n name=\"ExclusiveArticle\",\n fields=[\n (\n \"id\",\n- models.AutoField(\n- verbose_name=\"ID\",\n- serialize=False,\n+ models.BigAutoField(\n auto_created=True,\n primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n ),\n ),\n (\"title\", models.CharField(max_length=50)),\n@@ -48,18 +59,22 @@ class Migration(migrations.Migration):\n options={\n \"abstract\": False,\n },\n+ managers=[\n+ (\"objects\", django.db.models.manager.Manager()),\n+ (\"on_site\", django.contrib.sites.managers.CurrentSiteManager()),\n+ ],\n bases=(models.Model,),\n ),\n migrations.CreateModel(\n name=\"SyndicatedArticle\",\n fields=[\n (\n \"id\",\n- models.AutoField(\n- verbose_name=\"ID\",\n- serialize=False,\n+ models.BigAutoField(\n auto_created=True,\n primary_key=True,\n+ serialize=False,\n+ verbose_name=\"ID\",\n ),\n ),\n (\"title\", models.CharField(max_length=50)),\n@@ -68,6 +83,10 @@ class Migration(migrations.Migration):\n options={\n \"abstract\": False,\n },\n+ managers=[\n+ (\"objects\", django.db.models.manager.Manager()),\n+ (\"on_site\", django.contrib.sites.managers.CurrentSiteManager()),\n+ ],\n bases=(models.Model,),\n ),\n ]"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3645577269,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks, this looks promising. I have initial comments.",
+ "submitted_at": "2026-01-09T21:11:29+00:00"
+ },
+ {
+ "id": 3646860418,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-10T13:40:13+00:00"
+ },
+ {
+ "id": 3651315968,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks for the updates 👍",
+ "submitted_at": "2026-01-12T15:41:05+00:00"
+ },
+ {
+ "id": 3674283464,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-17T17:23:20+00:00"
+ },
+ {
+ "id": 3674284497,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-17T17:26:16+00:00"
+ },
+ {
+ "id": 3678239542,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks for the updates, almost there 👍",
+ "submitted_at": "2026-01-19T14:03:12+00:00"
+ },
+ {
+ "id": 3678246721,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T14:04:20+00:00"
+ },
+ {
+ "id": 3678265608,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T14:08:34+00:00"
+ },
+ {
+ "id": 3678858297,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T16:29:53+00:00"
+ },
+ {
+ "id": 3678887213,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T16:34:22+00:00"
+ },
+ {
+ "id": 3678983345,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T16:51:44+00:00"
+ },
+ {
+ "id": 3679033503,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-19T17:06:47+00:00"
+ },
+ {
+ "id": 3679119472,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks, great work!",
+ "submitted_at": "2026-01-19T17:41:36+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2677627654,
+ "user": "user_3a67c55598c5",
+ "body": "It would be nice to find a solution that didn't depend on executing the script from a different working directory.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-09T21:07:46+00:00"
+ },
+ {
+ "id": 2677628618,
+ "user": "user_3a67c55598c5",
+ "body": "You can bump to 3.14",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-09T21:08:11+00:00"
+ },
+ {
+ "id": 2677628877,
+ "user": "user_3a67c55598c5",
+ "body": "and v6",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-09T21:08:18+00:00"
+ },
+ {
+ "id": 2678663999,
+ "user": "user_f5eee7dbaa84",
+ "body": "Thankyou for the review , changes are done. Ready for another review .",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-10T13:40:13+00:00"
+ },
+ {
+ "id": 2682732352,
+ "user": "user_3a67c55598c5",
+ "body": "Since these are tests, instead of adding new migration files, you can just edit the prior migrations.",
+ "path": "tests/sites_framework/migrations/0002_alter_customarticle_managers_and_more.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:19:39+00:00"
+ },
+ {
+ "id": 2682735505,
+ "user": "user_3a67c55598c5",
+ "body": "Ensure there's a blank line at the end.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:20:23+00:00"
+ },
+ {
+ "id": 2682742169,
+ "user": "user_3a67c55598c5",
+ "body": "Do we need to run this with `--settings=test_postgres` to be able to lint the tests under `postgres_tests`? There are other workflows that do this.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:21:38+00:00"
+ },
+ {
+ "id": 2682747572,
+ "user": "user_3a67c55598c5",
+ "body": "Can you tell me how you reached the decision to add this? Would be nice to keep the workflow minimal.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:22:44+00:00"
+ },
+ {
+ "id": 2682749924,
+ "user": "user_3a67c55598c5",
+ "body": "We don't generally upgrade setuptools, see 42758f882dc74059c562ef8ae3da01fd06cf0e0d.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:23:15+00:00"
+ },
+ {
+ "id": 2682755885,
+ "user": "user_3a67c55598c5",
+ "body": "This is a little too strict, would miss `tests/content_types/operations_migrations/**`.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": 7,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:24:39+00:00"
+ },
+ {
+ "id": 2682775826,
+ "user": "user_3a67c55598c5",
+ "body": "Running this locally I got unexpected success because the database was `django.db.backends.dummy`.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:29:37+00:00"
+ },
+ {
+ "id": 2682823278,
+ "user": "user_3a67c55598c5",
+ "body": "I wouldn't catch any exceptions.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:40:17+00:00"
+ },
+ {
+ "id": 2682825236,
+ "user": "user_3a67c55598c5",
+ "body": "I'd add a comment that the reason we aren't using `check=True` is that `--check` directly calls `sys.exit(1)` instead of raising `CommandError`, which was a little unintuitive for me.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T15:40:48+00:00"
+ },
+ {
+ "id": 2701294508,
+ "user": "user_f5eee7dbaa84",
+ "body": "Done , I've added the migrations to use PostgreSQL settings , will use postgres to test out the migrations as well.",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-17T17:23:20+00:00"
+ },
+ {
+ "id": 2701295971,
+ "user": "user_f5eee7dbaa84",
+ "body": "I removed some dependencies that were significantly increasing build time, such as C-extension wheels, which are unnecessary for migration checks.\n\nI've removed the filtering now , using all dependencies .",
+ "path": ".github/workflows/check-migrations.yml",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-17T17:26:15+00:00"
+ },
+ {
+ "id": 2704899086,
+ "user": "user_3a67c55598c5",
+ "body": "I think we should run with `gis_enabled=True`, as I have several more failures:\n\n```py\nMigrations for 'gis_migrations':\n tests/gis_tests/gis_migrations/migrations/0003_remove_household_family_delete_heatmap_and_more.py\n - Remove field family from household\n - Delete model Heatmap\n - Remove field neighborhood from household\n - Delete model Family\n - Delete model Household\n - Delete model [NAME_REDACTED] for 'rasterapp':\n tests/gis_tests/rasterapp/migrations/0003_alter_rastermodel_id_alter_rasterrelatedmodel_id.py\n ~ Alter field id on rastermodel\n ~ Alter field id on rasterrelatedmodel\n```\n\nYou could borrow the CI config in the `postgis.yml`.",
+ "path": "scripts/check_migrations.py",
+ "line": 17,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T14:02:54+00:00"
+ },
+ {
+ "id": 2704904951,
+ "user": "user_3a67c55598c5",
+ "body": "verbosity=3 would be a nice convenience, so that when this fails on CI you don't have to re-run it manually to get the changes.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T14:04:20+00:00"
+ },
+ {
+ "id": 2704922159,
+ "user": "user_3a67c55598c5",
+ "body": "Ah, well, on second look it looks like for the `gis_migrations` case there might be too much variance between GIS backends, plus the dynamic way the tests in `test_operations.py` are written. So maybe it's okay to leave this as is.\n\nWe could still fold in the fixes for `rasterapp`, though? 🤔",
+ "path": "scripts/check_migrations.py",
+ "line": 17,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T14:08:33+00:00"
+ },
+ {
+ "id": 2705421314,
+ "user": "user_3a67c55598c5",
+ "body": "Looks like we can't do this, see https://github.com/[USER_REDACTED]ngo/django/pull/20466#discussion_r2704922159.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T16:29:53+00:00"
+ },
+ {
+ "id": 2705445137,
+ "user": "user_f5eee7dbaa84",
+ "body": "Yes , I was trying if this is possible . Migrations can be fixed by adding \n\n```\n\nif connection.features.supports_raster:\n ops.insert(1, migrations.DeleteModel(name=\"Heatmap\"))\n\n```\n\nas Heatmap has \"supports_raster\" in 0002 migration file \nand changing a test case (checking the deleted model) . \n\nShould I add this or let ``` gis_enabled = False ``` ?",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T16:34:22+00:00"
+ },
+ {
+ "id": 2705526307,
+ "user": "user_3a67c55598c5",
+ "body": "Can you tell me a little more about that idea? My understanding was that we don't have a python model for `Neighborhood` anywhere, so I would expect the `makemigrations --check` to be a poor fit for that test paradigm.",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T16:51:44+00:00"
+ },
+ {
+ "id": 2705568329,
+ "user": "user_f5eee7dbaa84",
+ "body": "Oh, my bad , Got it ! I've removed gis tests entirely . Thankyou for clarity .",
+ "path": "scripts/check_migrations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-19T17:06:47+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "yml"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 12,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 21,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 22
+ }
+}
+{
+ "_id": "bbbf43ef7c0ed4da",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.562181+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20462,
+ "title": "Fixed #36827 -- Added support for exclusion constraints using Hash indexes on PostgreSQL.",
+ "body": "#### Trac ticket number\n\nticket-36827\n\n#### Branch description\n\nAdd support for Hash index type for `ExclusionConstraint` in PostgreSQL.\n\n#### Checklist\n- [x] This PR targets the `main` branch.\n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_d2d82edb4e7b",
+ "created_at": "2025-12-25T09:51:57+00:00",
+ "merged_at": "2026-01-10T07:45:14+00:00",
+ "base_branch": "main",
+ "head_branch": "hash-exclusion-constraint",
+ "additions": 115,
+ "deletions": 7,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/contrib/postgres/constraints.py",
+ "status": "modified",
+ "additions": 21,
+ "deletions": 2,
+ "changes": 23,
+ "patch": "@@ -9,6 +9,7 @@\n from django.db.models.lookups import PostgresOperatorLookup\n from django.db.models.sql import Query\n \n+from .fields import RangeOperators\n from .utils import CheckPostgresInstalledMixin\n \n __all__ = [\"ExclusionConstraint\"]\n@@ -36,9 +37,9 @@ def __init__(\n violation_error_code=None,\n violation_error_message=None,\n ):\n- if index_type and index_type.lower() not in {\"gist\", \"spgist\"}:\n+ if index_type and index_type.lower() not in {\"gist\", \"hash\", \"spgist\"}:\n raise ValueError(\n- \"Exclusion constraints only support GiST or SP-GiST indexes.\"\n+ \"Exclusion constraints only support GiST, Hash, or SP-GiST indexes.\"\n )\n if not expressions:\n raise ValueError(\n@@ -57,6 +58,24 @@ def __init__(\n )\n if not isinstance(include, (NoneType, list, tuple)):\n raise ValueError(\"ExclusionConstraint.include must be a list or tuple.\")\n+ if index_type and index_type.lower() == \"hash\":\n+ if include:\n+ raise ValueError(\n+ \"Covering exclusion constraints using Hash indexes are not \"\n+ \"supported.\"\n+ )\n+ if not expressions:\n+ pass\n+ elif len(expressions) > 1:\n+ raise ValueError(\n+ \"Composite exclusion constraints using Hash indexes are not \"\n+ \"supported.\"\n+ )\n+ elif expressions[0][1] != RangeOperators.EQUAL:\n+ raise ValueError(\n+ \"Exclusion constraints using Hash indexes only support the EQUAL \"\n+ \"operator.\"\n+ )\n self.expressions = expressions\n self.index_type = index_type or \"GIST\"\n self.condition = condition"
+ },
+ {
+ "filename": "docs/ref/contrib/postgres/constraints.txt",
+ "status": "modified",
+ "additions": 7,
+ "deletions": 3,
+ "changes": 10,
+ "patch": "@@ -73,9 +73,13 @@ creates an exclusion constraint on ``circle`` using ``circle_ops``.\n \n .. attribute:: ExclusionConstraint.index_type\n \n-The index type of the constraint. Accepted values are ``GIST`` or ``SPGIST``.\n-Matching is case insensitive. If not provided, the default index type is\n-``GIST``.\n+The index type of the constraint. Accepted values are ``GiST``, ``Hash``, or\n+``SPGiST``. Matching is case insensitive. If not provided, the default index\n+type is ``GIST``.\n+\n+.. versionchanged:: 6.1\n+\n+ Support for exclusion constraints using Hash indexes was added.\n \n ``condition``\n -------------"
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -135,6 +135,9 @@ Minor features\n :class:`~django.contrib.postgres.fields.HStoreField` when ``psycopg`` 3.2+ is\n installed and ``django.contrib.postgres`` is in :setting:`INSTALLED_APPS`.\n \n+* :class:`~django.contrib.postgres.constraints.ExclusionConstraint` now\n+ supports the Hash index type.\n+\n :mod:`django.contrib.redirects`\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ },
+ {
+ "filename": "tests/postgres_tests/test_constraints.py",
+ "status": "modified",
+ "additions": 84,
+ "deletions": 2,
+ "changes": 86,
+ "patch": "@@ -27,7 +27,13 @@\n from django.utils import timezone\n \n from . import PostgreSQLTestCase\n-from .models import HotelReservation, IntegerArrayModel, RangesModel, Room, Scene\n+from .models import (\n+ HotelReservation,\n+ IntegerArrayModel,\n+ RangesModel,\n+ Room,\n+ Scene,\n+)\n \n try:\n from django.contrib.postgres.constraints import ExclusionConstraint\n@@ -299,7 +305,7 @@ def test_invalid_condition(self):\n )\n \n def test_invalid_index_type(self):\n- msg = \"Exclusion constraints only support GiST or SP-GiST indexes.\"\n+ msg = \"Exclusion constraints only support GiST, Hash, or SP-GiST indexes.\"\n with self.assertRaisesMessage(ValueError, msg):\n ExclusionConstraint(\n index_type=\"gin\",\n@@ -480,6 +486,18 @@ def test_repr(self):\n \"(F(datespan), '-|-')] name='exclude_overlapping' \"\n \"violation_error_code='overlapping_must_be_excluded'>\",\n )\n+ constraint = ExclusionConstraint(\n+ name=\"exclude_equal_hash\",\n+ index_type=\"hash\",\n+ expressions=[(F(\"room\"), RangeOperators.EQUAL)],\n+ violation_error_code=\"room_must_be_unique\",\n+ )\n+ self.assertEqual(\n+ repr(constraint),\n+ \"\",\n+ )\n \n def test_eq(self):\n constraint_1 = ExclusionConstraint(\n@@ -581,6 +599,12 @@ def test_eq(self):\n violation_error_code=\"custom_code\",\n violation_error_message=\"other custom error\",\n )\n+ constraint_13 = ExclusionConstraint(\n+ name=\"exclude_equal_hash\",\n+ index_type=\"hash\",\n+ expressions=[(F(\"room\"), RangeOperators.EQUAL)],\n+ violation_error_code=\"room_must_be_unique\",\n+ )\n self.assertEqual(constraint_1, constraint_1)\n self.assertEqual(constraint_1, mock.ANY)\n self.assertNotEqual(constraint_1, constraint_2)\n@@ -597,8 +621,10 @@ def test_eq(self):\n self.assertNotEqual(constraint_1, object())\n self.assertNotEqual(constraint_10, constraint_11)\n self.assertNotEqual(constraint_11, constraint_12)\n+ self.assertNotEqual(constraint_12, constraint_13)\n self.assertEqual(constraint_10, constraint_10)\n self.assertEqual(constraint_12, constraint_12)\n+ self.assertEqual(constraint_13, constraint_13)\n \n def test_deconstruct(self):\n constraint = ExclusionConstraint(\n@@ -1256,6 +1282,26 @@ def test_range_equal_cast(self):\n editor.add_constraint(Room, constraint)\n self.assertIn(constraint_name, self.get_constraints(Room._meta.db_table))\n \n+ def test_hash_uniqueness(self):\n+ constraint_name = \"exclusion_equal_room_hash\"\n+ self.assertNotIn(constraint_name, self.get_constraints(Room._meta.db_table))\n+ constraint = ExclusionConstraint(\n+ name=constraint_name,\n+ index_type=\"hash\",\n+ expressions=[(F(\"number\"), RangeOperators.EQUAL)],\n+ )\n+ with connection.schema_editor() as editor:\n+ editor.add_constraint(Room, constraint)\n+ self.assertIn(constraint_name, self.get_constraints(Room._meta.db_table))\n+ Room.objects.create(number=101)\n+ with self.assertRaises(IntegrityError), transaction.atomic():\n+ Room.objects.create(number=101)\n+ Room.objects.create(number=102)\n+ # Drop the constraint.\n+ with connection.schema_editor() as editor:\n+ editor.remove_constraint(Room, constraint)\n+ self.assertNotIn(constraint.name, self.get_constraints(Room._meta.db_table))\n+\n [USER_REDACTED]_apps(\"postgres_tests\")\n def test_table_create(self):\n constraint_name = \"exclusion_equal_number_tc\"\n@@ -1287,3 +1333,39 @@ def test_database_default(self):\n msg = \"Constraint “ints_equal” is violated.\"\n with self.assertRaisesMessage(ValidationError, msg):\n constraint.validate(RangesModel, RangesModel())\n+\n+ def test_covering_hash_index_not_supported(self):\n+ constraint_name = \"covering_hash_index_not_supported\"\n+ msg = \"Covering exclusion constraints using Hash indexes are not supported.\"\n+ with self.assertRaisesMessage(ValueError, msg):\n+ ExclusionConstraint(\n+ name=constraint_name,\n+ expressions=[(\"int1\", RangeOperators.EQUAL)],\n+ index_type=\"hash\",\n+ include=[\"int2\"],\n+ )\n+\n+ def test_composite_hash_index_not_supported(self):\n+ constraint_name = \"composite_hash_index_not_supported\"\n+ msg = \"Composite exclusion constraints using Hash indexes are not supported.\"\n+ with self.assertRaisesMessage(ValueError, msg):\n+ ExclusionConstraint(\n+ name=constraint_name,\n+ expressions=[\n+ (\"int1\", RangeOperators.EQUAL),\n+ (\"int2\", RangeOperators.EQUAL),\n+ ],\n+ index_type=\"hash\",\n+ )\n+\n+ def test_non_equal_hash_index_not_supported(self):\n+ constraint_name = \"none_equal_hash_index_not_supported\"\n+ msg = (\n+ \"Exclusion constraints using Hash indexes only support the EQUAL operator.\"\n+ )\n+ with self.assertRaisesMessage(ValueError, msg):\n+ ExclusionConstraint(\n+ name=constraint_name,\n+ expressions=[(\"int1\", RangeOperators.NOT_EQUAL)],\n+ index_type=\"hash\",\n+ )"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3612147699,
+ "user": "user_057de2f3b132",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-12-25T11:08:54+00:00"
+ },
+ {
+ "id": 3612446330,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": "Looking at c2f6c05c4cc73e831b7e852eb58bd6d7a83fa46c which added SP-GiST support the only part that might have been missing here was to confirm that `main` which is Postgres 15+ supports it with all options.\n\nVanilla support [is oviously the case](https://dbfiddle.uk/Rp5Vk5XG) as `HashIndex` has been around forever (Django 2.2) so this was most likely an omission when we added `ExclusionConstraint` but [it's not the case](https://dbfiddle.uk/OunMZxrA) for covering indices (see `include` option) which we'll need to add a check for [like we use to do](https://github.com/[USER_REDACTED]ngo/django/commit/b049bec7cfe9b5854584d240addb44fa1e9375a5#diff-a4e33792faf48c1d998ea65d49b65a6ab695efad8c2b74891180e055342e92eeL117-L141) and [tested](https://github.com/[USER_REDACTED]ngo/django/commit/b049bec7cfe9b5854584d240addb44fa1e9375a5#diff-9bcfdc1360b06330a51e54b7565748f9ef23685b7ac2983d7b390bd93e7f71e1L1087-L1107) before we dropped support for Postgres 14.",
+ "submitted_at": "2025-12-25T15:51:43+00:00"
+ },
+ {
+ "id": 3616830557,
+ "user": "user_8fc305198eb3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-29T22:10:26+00:00"
+ },
+ {
+ "id": 3617556076,
+ "user": "user_d2d82edb4e7b",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-30T08:26:49+00:00"
+ },
+ {
+ "id": 3625013881,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-04T13:44:01+00:00"
+ },
+ {
+ "id": 3625177604,
+ "user": "user_8fc305198eb3",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-04T21:22:55+00:00"
+ },
+ {
+ "id": 3627026675,
+ "user": "user_d2d82edb4e7b",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-05T14:13:58+00:00"
+ },
+ {
+ "id": 3636152473,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-07T18:02:35+00:00"
+ },
+ {
+ "id": 3636525682,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-07T19:42:43+00:00"
+ },
+ {
+ "id": 3639527243,
+ "user": "user_c332d334e171",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T14:09:41+00:00"
+ },
+ {
+ "id": 3639789010,
+ "user": "user_c332d334e171",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-08T14:53:29+00:00"
+ },
+ {
+ "id": 3646518054,
+ "user": "user_5501cd6d3dc8",
+ "state": "APPROVED",
+ "body": "[USER_REDACTED] Thanks :+1: I pushed tiny final edits.",
+ "submitted_at": "2026-01-10T07:09:23+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2646872137,
+ "user": "user_057de2f3b132",
+ "body": "We'll need a `versionadded` or `versionchanged` marker.",
+ "path": "docs/ref/contrib/postgres/constraints.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-25T11:08:18+00:00"
+ },
+ {
+ "id": 2651856092,
+ "user": "user_8fc305198eb3",
+ "body": "Why not do all of this validation up in `__init__` ? It seems weird to validate the type there, but then delay this extra validation until SQL creation.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-29T22:10:26+00:00"
+ },
+ {
+ "id": 2652498439,
+ "user": "user_d2d82edb4e7b",
+ "body": "[NAME_REDACTED], I added it like that because this is how it was done before support for PostgreSQL 14 was dropped:\n\nhttps://github.com/[USER_REDACTED]ngo/django/commit/b049bec7cfe9b5854584d240addb44fa1e9375a5#diff-a4e33792faf48c1d998ea65d49b65a6ab695efad8c2b74891180e055342e92eeL117-L141\n\nLooking at other constraints (such as UniqueConstraint) I think the checks in `__init__` are focusing more on types rather then database support or potential runtime errors so I don't this is the right place for these types of checks.\n\nIt seems like these checks are better off as Django checks. See for example similar checks in `UniqueConstraint`:\n\nhttps://github.com/[USER_REDACTED]ngo/django/blob/ccf74f7dc771313b41e7c2912a71f9c5b0ae5e1d/django/db/models/constraints.py#L338\n\nTo recap the options here:\n\n1. No checks (there are currently no checks for the other index types)\n2. Raise `ValueError` in `__init__`\n3. [NAME_REDACTED] checks in `check()` (consistent with other constraints)\n4. Check at runtime when producing the SQL (as it used to be, and how it's currently implemented in this PR)",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T08:26:49+00:00"
+ },
+ {
+ "id": 2659676600,
+ "user": "user_5501cd6d3dc8",
+ "body": "I'd prefer the 2nd option (`ValueError` in `__init__()`) previous checks were implemented in `check_support()` because they required database connection to check feature flags (`schema_editor.connection`). New checks are not database dependent.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-04T13:44:01+00:00"
+ },
+ {
+ "id": 2659936676,
+ "user": "user_8fc305198eb3",
+ "body": "Yes, I agree for the same reasoning.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-04T21:22:55+00:00"
+ },
+ {
+ "id": 2661652476,
+ "user": "user_d2d82edb4e7b",
+ "body": "I've added a commit to move the checks to `__init__.py` as `ValueError` + updated the tests. \n\nLet me know if we are good to go and I'll squash.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-05T14:13:58+00:00"
+ },
+ {
+ "id": 2669546431,
+ "user": "user_5501cd6d3dc8",
+ "body": "[USER_REDACTED] Thanks for updates :+1: I will move it forward during the weekend.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T18:02:35+00:00"
+ },
+ {
+ "id": 2669846136,
+ "user": "user_3a67c55598c5",
+ "body": "2nd option also aligns with ticket-36813.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-07T19:42:42+00:00"
+ },
+ {
+ "id": 2672447704,
+ "user": "user_c332d334e171",
+ "body": "```suggestion\n if index_type and index_type.lower() not in {\"gist\", \"hash\", \"spgist\"}:\n```\nI suggest to preserve the alphabetic order for code readability.",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T13:52:46+00:00"
+ },
+ {
+ "id": 2672464036,
+ "user": "user_c332d334e171",
+ "body": "```suggestion\n \"Exclusion constraints only support GiST, Hash or SP-GiST indexes.\"\n```",
+ "path": "django/contrib/postgres/constraints.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T13:57:26+00:00"
+ },
+ {
+ "id": 2672505252,
+ "user": "user_c332d334e171",
+ "body": "```suggestion\nThe index type of the constraint. Accepted values are ``GiST``, ``Hash`` or\n```",
+ "path": "docs/ref/contrib/postgres/constraints.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T14:08:20+00:00"
+ },
+ {
+ "id": 2672506196,
+ "user": "user_c332d334e171",
+ "body": "```suggestion\n``SP-GiST``. Matching is case insensitive. If not provided, the default index type\n```",
+ "path": "docs/ref/contrib/postgres/constraints.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T14:08:35+00:00"
+ },
+ {
+ "id": 2672507058,
+ "user": "user_c332d334e171",
+ "body": "```suggestion\nis ``GiST``.\n```",
+ "path": "docs/ref/contrib/postgres/constraints.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T14:08:50+00:00"
+ },
+ {
+ "id": 2672673528,
+ "user": "user_c332d334e171",
+ "body": "I think you missed this one with \"SP-GiST\"",
+ "path": "docs/ref/contrib/postgres/constraints.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-08T14:53:29+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 2,
+ "COMMENTED": 10
+ },
+ "meaningful_comment_count": 14,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 14
+ }
+}
+{
+ "_id": "05ad637b8e872c39",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20461,
+ "title": "Fixed #36822 -- Added parameter limit for PostgreSQL with server-side binding.",
+ "body": "#### Trac ticket number\n\n\nticket-36822\n\n#### Branch description\nAdded max_query_params and bulk_batch_size() to the PostgreSQL backend to handle the 65535 parameter limit when using server-side binding with psycopg3. When server_side_binding=True is configured in database OPTIONS, PostgreSQL has a hard limit of 65535 query parameters.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_ed8298a0306d",
+ "created_at": "2025-12-25T08:31:58+00:00",
+ "merged_at": "2026-01-16T14:15:53+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-36822",
+ "additions": 92,
+ "deletions": 95,
+ "changed_files": 9,
+ "files": [
+ {
+ "filename": "django/db/backends/base/operations.py",
+ "status": "modified",
+ "additions": 13,
+ "deletions": 1,
+ "changes": 14,
+ "patch": "@@ -2,12 +2,14 @@\n import decimal\n import json\n from importlib import import_module\n+from itertools import chain\n \n import sqlparse\n \n from django.conf import settings\n from django.db import NotSupportedError, transaction\n from django.db.models.expressions import Col\n+from django.db.models.fields.composite import CompositePrimaryKey\n from django.utils import timezone\n from django.utils.duration import duration_microseconds\n from django.utils.encoding import force_str\n@@ -78,7 +80,17 @@ def bulk_batch_size(self, fields, objs):\n are the fields going to be inserted in the batch, the objs contains\n all the objects to be inserted.\n \"\"\"\n- return len(objs)\n+ if self.connection.features.max_query_params is None or not fields:\n+ return len(objs)\n+\n+ return self.connection.features.max_query_params // len(\n+ list(\n+ chain.from_iterable(\n+ field.fields if isinstance(field, CompositePrimaryKey) else [field]\n+ for field in fields\n+ )\n+ )\n+ )\n \n def format_for_duration_arithmetic(self, sql):\n raise NotImplementedError("
+ },
+ {
+ "filename": "django/db/backends/oracle/operations.py",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 14,
+ "changes": 14,
+ "patch": "@@ -1,15 +1,13 @@\n import datetime\n import uuid\n from functools import lru_cache\n-from itertools import chain\n \n from django.conf import settings\n from django.db import NotSupportedError\n from django.db.backends.base.operations import BaseDatabaseOperations\n from django.db.backends.utils import split_tzname_delta, strip_quotes, truncate_name\n from django.db.models import (\n AutoField,\n- CompositePrimaryKey,\n Exists,\n ExpressionWrapper,\n Lookup,\n@@ -707,18 +705,6 @@ def subtract_temporals(self, internal_type, lhs, rhs):\n )\n return super().subtract_temporals(internal_type, lhs, rhs)\n \n- def bulk_batch_size(self, fields, objs):\n- \"\"\"Oracle restricts the number of parameters in a query.\"\"\"\n- fields = list(\n- chain.from_iterable(\n- field.fields if isinstance(field, CompositePrimaryKey) else [field]\n- for field in fields\n- )\n- )\n- if fields:\n- return self.connection.features.max_query_params // len(fields)\n- return len(objs)\n-\n def conditional_expression_supported_in_where_clause(self, expression):\n \"\"\"\n Oracle supports only EXISTS(...) or filters in the WHERE clause, others"
+ },
+ {
+ "filename": "django/db/backends/postgresql/features.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 0,
+ "changes": 6,
+ "patch": "@@ -151,6 +151,12 @@ def uses_server_side_binding(self):\n options = self.connection.settings_dict[\"OPTIONS\"]\n return is_psycopg3 and options.get(\"server_side_binding\") is True\n \n+ [USER_REDACTED]_property\n+ def max_query_params(self):\n+ if self.uses_server_side_binding:\n+ return 2**16 - 1\n+ return None\n+\n [USER_REDACTED]_property\n def prohibits_null_characters_in_text_exception(self):\n if is_psycopg3:"
+ },
+ {
+ "filename": "django/db/backends/sqlite3/operations.py",
+ "status": "modified",
+ "additions": 0,
+ "deletions": 20,
+ "changes": 20,
+ "patch": "@@ -29,26 +29,6 @@ class DatabaseOperations(BaseDatabaseOperations):\n # SQLite. Use JSON_TYPE() instead.\n jsonfield_datatype_values = frozenset([\"null\", \"false\", \"true\"])\n \n- def bulk_batch_size(self, fields, objs):\n- \"\"\"\n- SQLite has a variable limit defined by SQLITE_LIMIT_VARIABLE_NUMBER\n- (reflected in max_query_params).\n- \"\"\"\n- fields = list(\n- chain.from_iterable(\n- (\n- field.fields\n- if isinstance(field, models.CompositePrimaryKey)\n- else [field]\n- )\n- for field in fields\n- )\n- )\n- if fields:\n- return self.connection.features.max_query_params // len(fields)\n- else:\n- return len(objs)\n-\n def check_expression_support(self, expression):\n bad_fields = (models.DateField, models.DateTimeField, models.TimeField)\n bad_aggregates = (models.Sum, models.Avg, models.Variance, models.StdDev)"
+ },
+ {
+ "filename": "tests/backends/base/test_operations.py",
+ "status": "modified",
+ "additions": 52,
+ "deletions": 2,
+ "changes": 54,
+ "patch": "@@ -1,7 +1,7 @@\n import decimal\n \n from django.core.management.color import no_style\n-from django.db import NotSupportedError, connection, transaction\n+from django.db import NotSupportedError, connection, models, transaction\n from django.db.backends.base.operations import BaseDatabaseOperations\n from django.db.models import DurationField\n from django.db.models.expressions import Col\n@@ -11,10 +11,11 @@\n TransactionTestCase,\n override_settings,\n skipIfDBFeature,\n+ skipUnlessDBFeature,\n )\n from django.utils import timezone\n \n-from ..models import Author, Book\n+from ..models import Author, Book, Person\n \n \n class SimpleDatabaseOperationTests(SimpleTestCase):\n@@ -201,6 +202,55 @@ def test_subtract_temporals(self):\n with self.assertRaisesMessage(NotSupportedError, msg):\n self.ops.subtract_temporals(duration_field_internal_type, None, None)\n \n+ [USER_REDACTED](\"max_query_params\")\n+ def test_bulk_batch_size_limited(self):\n+ max_query_params = connection.features.max_query_params\n+ objects = range(max_query_params + 1)\n+ first_name_field = Person._meta.get_field(\"first_name\")\n+ last_name_field = Person._meta.get_field(\"last_name\")\n+ composite_pk = models.CompositePrimaryKey(\"first_name\", \"last_name\")\n+ composite_pk.fields = [first_name_field, last_name_field]\n+\n+ self.assertEqual(connection.ops.bulk_batch_size([], objects), len(objects))\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size([first_name_field], objects),\n+ max_query_params,\n+ )\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size(\n+ [first_name_field, last_name_field], objects\n+ ),\n+ max_query_params // 2,\n+ )\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size([composite_pk, first_name_field], objects),\n+ max_query_params // 3,\n+ )\n+\n+ [USER_REDACTED](\"max_query_params\")\n+ def test_bulk_batch_size_unlimited(self):\n+ objects = range(2**16 + 1)\n+ first_name_field = Person._meta.get_field(\"first_name\")\n+ last_name_field = Person._meta.get_field(\"last_name\")\n+ composite_pk = models.CompositePrimaryKey(\"first_name\", \"last_name\")\n+ composite_pk.fields = [first_name_field, last_name_field]\n+\n+ self.assertEqual(connection.ops.bulk_batch_size([], objects), len(objects))\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size([first_name_field], objects),\n+ len(objects),\n+ )\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size(\n+ [first_name_field, last_name_field], objects\n+ ),\n+ len(objects),\n+ )\n+ self.assertEqual(\n+ connection.ops.bulk_batch_size([composite_pk, first_name_field], objects),\n+ len(objects),\n+ )\n+\n \n class SqlFlushTests(TransactionTestCase):\n available_apps = [\"backends\"]"
+ },
+ {
+ "filename": "tests/backends/oracle/test_operations.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 26,
+ "changes": 27,
+ "patch": "@@ -1,7 +1,7 @@\n import unittest\n \n from django.core.management.color import no_style\n-from django.db import connection, models\n+from django.db import connection\n from django.test import TransactionTestCase\n \n from ..models import Person, Tag\n@@ -17,31 +17,6 @@ def test_sequence_name_truncation(self):\n )\n self.assertEqual(seq_name, \"SCHEMA_AUTHORWITHEVENLOB0B8_SQ\")\n \n- def test_bulk_batch_size(self):\n- # Oracle restricts the number of parameters in a query.\n- objects = range(2**16)\n- self.assertEqual(connection.ops.bulk_batch_size([], objects), len(objects))\n- # Each field is a parameter for each object.\n- first_name_field = Person._meta.get_field(\"first_name\")\n- last_name_field = Person._meta.get_field(\"last_name\")\n- self.assertEqual(\n- connection.ops.bulk_batch_size([first_name_field], objects),\n- connection.features.max_query_params,\n- )\n- self.assertEqual(\n- connection.ops.bulk_batch_size(\n- [first_name_field, last_name_field],\n- objects,\n- ),\n- connection.features.max_query_params // 2,\n- )\n- composite_pk = models.CompositePrimaryKey(\"first_name\", \"last_name\")\n- composite_pk.fields = [first_name_field, last_name_field]\n- self.assertEqual(\n- connection.ops.bulk_batch_size([composite_pk, first_name_field], objects),\n- connection.features.max_query_params // 3,\n- )\n-\n def test_sql_flush(self):\n statements = connection.ops.sql_flush(\n no_style(),"
+ },
+ {
+ "filename": "tests/backends/postgresql/test_features.py",
+ "status": "added",
+ "additions": 14,
+ "deletions": 0,
+ "changes": 14,
+ "patch": "@@ -0,0 +1,14 @@\n+import unittest\n+\n+from django.db import connection\n+from django.test import TestCase\n+\n+\n+[USER_REDACTED].skipUnless(connection.vendor == \"postgresql\", \"PostgreSQL tests\")\n+class FeaturesTests(TestCase):\n+ def test_max_query_params_respects_server_side_params(self):\n+ if connection.features.uses_server_side_binding:\n+ limit = 2**16 - 1\n+ else:\n+ limit = None\n+ self.assertEqual(connection.features.max_query_params, limit)"
+ },
+ {
+ "filename": "tests/backends/sqlite/test_operations.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 24,
+ "changes": 25,
+ "patch": "@@ -2,7 +2,7 @@\n import unittest\n \n from django.core.management.color import no_style\n-from django.db import connection, models\n+from django.db import connection\n from django.test import TestCase\n \n from ..models import Person, Tag\n@@ -88,29 +88,6 @@ def test_sql_flush_sequences_allow_cascade(self):\n statements[-1],\n )\n \n- def test_bulk_batch_size(self):\n- self.assertEqual(connection.ops.bulk_batch_size([], [Person()]), 1)\n- first_name_field = Person._meta.get_field(\"first_name\")\n- last_name_field = Person._meta.get_field(\"last_name\")\n- self.assertEqual(\n- connection.ops.bulk_batch_size([first_name_field], [Person()]),\n- connection.features.max_query_params,\n- )\n- self.assertEqual(\n- connection.ops.bulk_batch_size(\n- [first_name_field, last_name_field], [Person()]\n- ),\n- connection.features.max_query_params // 2,\n- )\n- composite_pk = models.CompositePrimaryKey(\"first_name\", \"last_name\")\n- composite_pk.fields = [first_name_field, last_name_field]\n- self.assertEqual(\n- connection.ops.bulk_batch_size(\n- [composite_pk, first_name_field], [Person()]\n- ),\n- connection.features.max_query_params // 3,\n- )\n-\n def test_bulk_batch_size_respects_variable_limit(self):\n first_name_field = Person._meta.get_field(\"first_name\")\n last_name_field = Person._meta.get_field(\"last_name\")"
+ },
+ {
+ "filename": "tests/composite_pk/tests.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 8,
+ "changes": 13,
+ "patch": "@@ -149,21 +149,18 @@ def test_in_bulk(self):\n \n def test_in_bulk_batching(self):\n Comment.objects.all().delete()\n- batching_required = connection.features.max_query_params is not None\n- expected_queries = 2 if batching_required else 1\n+ num_objects = 10\n+ connection.features.__dict__.pop(\"max_query_params\", None)\n with unittest.mock.patch.object(\n- type(connection.features), \"max_query_params\", 10\n+ type(connection.features), \"max_query_params\", num_objects\n ):\n- num_requiring_batching = (\n- connection.ops.bulk_batch_size([Comment._meta.pk], []) + 1\n- )\n comments = [\n Comment(id=i, tenant=self.tenant, user=self.user)\n- for i in range(1, num_requiring_batching + 1)\n+ for i in range(1, num_objects + 1)\n ]\n Comment.objects.bulk_create(comments)\n id_list = list(Comment.objects.values_list(\"pk\", flat=True))\n- with self.assertNumQueries(expected_queries):\n+ with self.assertNumQueries(2):\n comment_dict = Comment.objects.in_bulk(id_list=id_list)\n self.assertQuerySetEqual(comment_dict, id_list)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3612432316,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-25T15:21:53+00:00"
+ },
+ {
+ "id": 3613404601,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-26T13:08:49+00:00"
+ },
+ {
+ "id": 3613407771,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-26T13:10:43+00:00"
+ },
+ {
+ "id": 3616013459,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-29T14:28:51+00:00"
+ },
+ {
+ "id": 3618329163,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-30T14:00:01+00:00"
+ },
+ {
+ "id": 3618381314,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-30T14:19:10+00:00"
+ },
+ {
+ "id": 3618466773,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-30T14:48:22+00:00"
+ },
+ {
+ "id": 3618400665,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Looking good [USER_REDACTED], I have just a few more things to run by you.",
+ "submitted_at": "2025-12-30T14:51:18+00:00"
+ },
+ {
+ "id": 3661629196,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T16:27:29+00:00"
+ },
+ {
+ "id": 3665406104,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks [USER_REDACTED] 👍, this is a nice refactor.",
+ "submitted_at": "2026-01-15T13:41:45+00:00"
+ },
+ {
+ "id": 3665708951,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T13:42:36+00:00"
+ },
+ {
+ "id": 3665774834,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-15T13:58:02+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2647115752,
+ "user": "user_cdda8932ec17",
+ "body": "Since the limit is only present when server-side cursors are used we should make this value a `cached_property` that introspects `self.connection.settings_dict[\"OPTIONS\"].get(\"server_side_binding\")` and return this value if its enabled and `None` otherwise.",
+ "path": "django/db/backends/postgresql/features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-25T15:21:16+00:00"
+ },
+ {
+ "id": 2647116043,
+ "user": "user_cdda8932ec17",
+ "body": "And then we should add a test with and without server-side cursors enabled.",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-25T15:21:51+00:00"
+ },
+ {
+ "id": 2648167464,
+ "user": "user_ed8298a0306d",
+ "body": "[USER_REDACTED] Thanks for the review! I've updated `max_query_params` to a `cached_property` that returns the limit only when `server_side_binding` is enabled.",
+ "path": "django/db/backends/postgresql/features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-26T13:08:49+00:00"
+ },
+ {
+ "id": 2648171063,
+ "user": "user_ed8298a0306d",
+ "body": "I've updated the test to cover both cases (with and without server-side binding).",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-26T13:10:43+00:00"
+ },
+ {
+ "id": 2651096279,
+ "user": "user_3a67c55598c5",
+ "body": "We have similar code for oracle & sqlite. I wonder if we should hoist all 3 implementations up to a single implementation on the superclass.\n\nWe might then one day implement a sane default for MySQL, which surely won't let you send a query of unbounded size even if the parameters have no strict upper limit.",
+ "path": "django/db/backends/postgresql/operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-29T14:28:51+00:00"
+ },
+ {
+ "id": 2653070630,
+ "user": "user_3a67c55598c5",
+ "body": "Do we need the late import?",
+ "path": "django/db/backends/base/operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:00:01+00:00"
+ },
+ {
+ "id": 2653106577,
+ "user": "user_ed8298a0306d",
+ "body": "I didn’t realize this code was shared across backends. Refactoring it as you suggested does make things cleaner. Thanks , [USER_REDACTED]",
+ "path": "django/db/backends/postgresql/operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:19:10+00:00"
+ },
+ {
+ "id": 2653120083,
+ "user": "user_3a67c55598c5",
+ "body": "I would just delegate to `uses_server_side_binding` since the added logic is slightly different.",
+ "path": "django/db/backends/postgresql/features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:26:02+00:00"
+ },
+ {
+ "id": 2653134752,
+ "user": "user_3a67c55598c5",
+ "body": "Then we could just mock `uses_server_side_binding`, which I think would improve the test a little bit.",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:33:04+00:00"
+ },
+ {
+ "id": 2653144535,
+ "user": "user_3a67c55598c5",
+ "body": "I'm starting to wonder if we should hoist these tests out of the oracle & sqlite tests and just have one base test. Then the postgres specific test only needs to test the postgres-specific part where we switch on server-side binding...",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:38:04+00:00"
+ },
+ {
+ "id": 2653145712,
+ "user": "user_3a67c55598c5",
+ "body": "... rather than reiterate all of these assertions.",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:38:46+00:00"
+ },
+ {
+ "id": 2653163511,
+ "user": "user_ed8298a0306d",
+ "body": "I initially added this because I thought it was causing a circular import, but I had mixed it up with another file. I’ve now moved the import to the top.",
+ "path": "django/db/backends/base/operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:48:22+00:00"
+ },
+ {
+ "id": 2653168624,
+ "user": "user_3a67c55598c5",
+ "body": "Can you tell me a little bit about this change? Was there a test isolation problem? What is the state of `connection.features` after this test?",
+ "path": "tests/composite_pk/tests.py",
+ "line": 153,
+ "side": "RIGHT",
+ "created_at": "2025-12-30T14:51:01+00:00"
+ },
+ {
+ "id": 2691162416,
+ "user": "user_ed8298a0306d",
+ "body": "This came up because `max_query_params` was changed to a `cached_property`. Once it calculates a value, it stores it in `__dict__` and just uses that stored value from then on. So when you try to mock the value in tests, if there's already a cached value, the mock won't take effect. You need to clear the cache with `.pop()` before applying the mock for it to work properly, which is why I made that change",
+ "path": "tests/composite_pk/tests.py",
+ "line": 153,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T16:27:29+00:00"
+ },
+ {
+ "id": 2694225682,
+ "user": "user_3a67c55598c5",
+ "body": "I tweaked the test so it could still run on MySQL, allowing me to move this test into one of the above test cases and remove the mixin 👍",
+ "path": "tests/backends/base/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T12:39:20+00:00"
+ },
+ {
+ "id": 2694226559,
+ "user": "user_3a67c55598c5",
+ "body": "I think we need to stop the mocker.",
+ "path": "tests/backends/base/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T12:39:37+00:00"
+ },
+ {
+ "id": 2694263000,
+ "user": "user_3a67c55598c5",
+ "body": "Now that the tests run on all backends, I think we no longer need this test.",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T12:50:31+00:00"
+ },
+ {
+ "id": 2694443445,
+ "user": "user_3a67c55598c5",
+ "body": "(Actually, just to ensure we had _something_ I replaced it with a simpler one. Our CI configuration tests with server side params enabled & not enabled.)",
+ "path": "tests/backends/postgresql/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T13:42:35+00:00"
+ },
+ {
+ "id": 2694499746,
+ "user": "user_ed8298a0306d",
+ "body": "Thank you for letting me know. I didn’t realize there was a way to do that. I hadn’t thought of writing it in SimpleDatabaseOperationTests.",
+ "path": "tests/backends/base/test_operations.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-15T13:58:02+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 11,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 19,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 19
+ }
+}
+{
+ "_id": "3d97483fa58ec9af",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20460,
+ "title": "Fixed #36821 -- Treated empty strings as NULL for iexact lookups on Oracle.",
+ "body": "#### Trac ticket number\n\n\nticket-36821\n\n#### Branch description\nThank you for providing the test code, [USER_REDACTED] \n\nOn Oracle, iexact did not handle empty strings the same way as exact, even though empty strings are treated as NULL.\nThis change makes iexact=\"\" behave consistently with exact by [NAME_REDACTED] IS NULL lookup.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_ed8298a0306d",
+ "created_at": "2025-12-25T03:01:29+00:00",
+ "merged_at": "2026-01-14T18:31:16+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-36821",
+ "additions": 15,
+ "deletions": 3,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "django/db/models/sql/query.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -1444,7 +1444,7 @@ def build_lookup(self, lookups, lhs, rhs):\n # DEFAULT_DB_ALIAS isn't nice but it's the best that can be done here.\n # A similar thing is done in is_nullable(), too.\n if (\n- lookup_name == \"exact\"\n+ lookup_name in (\"exact\", \"iexact\")\n and lookup.rhs == \"\"\n and connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls\n ):"
+ },
+ {
+ "filename": "tests/null_queries/models.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -7,7 +7,7 @@ class Poll(models.Model):\n \n class Choice(models.Model):\n poll = models.ForeignKey(Poll, models.CASCADE)\n- choice = models.CharField(max_length=200)\n+ choice = models.CharField(max_length=200, null=True)\n \n \n # A set of models with an inner one pointing to two outer ones."
+ },
+ {
+ "filename": "tests/null_queries/tests.py",
+ "status": "modified",
+ "additions": 13,
+ "deletions": 1,
+ "changes": 14,
+ "patch": "@@ -1,5 +1,5 @@\n from django.core.exceptions import FieldError\n-from django.test import TestCase\n+from django.test import TestCase, skipUnlessDBFeature\n \n from .models import Choice, Inner, OuterA, OuterB, Poll\n \n@@ -44,6 +44,18 @@ def test_none_as_null(self):\n with self.assertRaisesMessage(ValueError, \"Cannot use None as a query value\"):\n Choice.objects.filter(id__gt=None)\n \n+ [USER_REDACTED](\"interprets_empty_strings_as_nulls\")\n+ def test_empty_string_is_null(self):\n+ p = Poll.objects.create(question=\"?\")\n+ c1 = Choice.objects.create(poll=p, choice=None)\n+ c2 = Choice.objects.create(poll=p, choice=\"\")\n+ cases = [{\"choice__exact\": \"\"}, {\"choice__iexact\": \"\"}]\n+ for lookup in cases:\n+ with self.subTest(lookup):\n+ self.assertSequenceEqual(\n+ Choice.objects.filter(**lookup).order_by(\"id\"), [c1, c2]\n+ )\n+\n def test_unsaved(self):\n poll = Poll(question=\"How?\")\n msg = ("
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3652188810,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks!",
+ "submitted_at": "2026-01-12T18:41:30+00:00"
+ },
+ {
+ "id": 3661218232,
+ "user": "user_ed8298a0306d",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T15:05:08+00:00"
+ },
+ {
+ "id": 3662187969,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks 🥇",
+ "submitted_at": "2026-01-14T18:29:49+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2683458860,
+ "user": "user_3a67c55598c5",
+ "body": "Thanks, this location next to case-insensitive tests makes sense, but we could also move it to `NullQueriesTests`. What do you prefer?",
+ "path": "tests/queries/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T18:41:26+00:00"
+ },
+ {
+ "id": 2690832225,
+ "user": "user_ed8298a0306d",
+ "body": "Thanks for the suggestion! I'll move it to `NullQueriesTests`. Since both `None` and empty strings are converted to `IS NULL`, it makes sense to keep them together.",
+ "path": "tests/queries/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T15:05:08+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 2,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "81662449b72f05ae",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20458,
+ "title": "Fixed #36644 -- Enabled empty order_by() to avoid pk ordering by first()/last().",
+ "body": "#### Trac ticket number\n\n\nticket-36644\n\n#### Branch description\nEnabled calling `order_by()` without arguments to disable implicit primary key ordering in `first()`/`last()`. When a queryset is explicitly marked as unordered via `order_by()`, `first()`/`last()` now respect this and avoid adding PK ordering. Also reset default_ordering in `_combinator_query()` so that `union().first()` can still add pk ordering.\n\nDiscussion: https://github.com/[USER_REDACTED]ngo/new-features/issues/71, \n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_d96dcc7f8ae4",
+ "created_at": "2025-12-24T16:44:07+00:00",
+ "merged_at": "2026-02-06T20:45:45+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36644",
+ "additions": 49,
+ "deletions": 3,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/db/models/query.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 2,
+ "changes": 5,
+ "patch": "@@ -1158,7 +1158,7 @@ async def alatest(self, *fields):\n \n def first(self):\n \"\"\"Return the first object of a query or None if no match is found.\"\"\"\n- if self.ordered:\n+ if self.ordered or not self.query.default_ordering:\n queryset = self\n else:\n self._check_ordering_first_last_queryset_aggregation(method=\"first\")\n@@ -1171,7 +1171,7 @@ async def afirst(self):\n \n def last(self):\n \"\"\"Return the last object of a query or None if no match is found.\"\"\"\n- if self.ordered:\n+ if self.ordered or not self.query.default_ordering:\n queryset = self.reverse()\n else:\n self._check_ordering_first_last_queryset_aggregation(method=\"last\")\n@@ -1679,6 +1679,7 @@ def _combinator_query(self, combinator, *other_qs, all=False):\n clone = self._chain()\n # Clear limits and ordering so they can be reapplied\n clone.query.clear_ordering(force=True)\n+ clone.query.default_ordering = True\n clone.query.clear_limits()\n clone.query.combined_queries = (self.query, *(qs.query for qs in other_qs))\n clone.query.combinator = combinator"
+ },
+ {
+ "filename": "tests/get_earliest_or_latest/models.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -21,6 +21,14 @@ class Comment(models.Model):\n likes_count = models.PositiveIntegerField()\n \n \n+class OrderedArticle(models.Model):\n+ headline = models.CharField(max_length=100)\n+ pub_date = models.DateField()\n+\n+ class Meta:\n+ ordering = [\"headline\"]\n+\n+\n # Ticket #23555 - model with an intentionally broken QuerySet.__iter__ method."
+ },
+ {
+ "filename": "tests/get_earliest_or_latest/tests.py",
+ "status": "modified",
+ "additions": 29,
+ "deletions": 1,
+ "changes": 30,
+ "patch": "@@ -1,9 +1,10 @@\n from datetime import datetime\n+from unittest.mock import patch\n \n from django.db.models import Avg\n from django.test import TestCase\n \n-from .models import Article, Comment, IndexErrorArticle, Person\n+from .models import Article, Comment, IndexErrorArticle, OrderedArticle, Person\n \n \n class EarliestOrLatestTests(TestCase):\n@@ -265,3 +266,30 @@ def test_first_last_unordered_qs_aggregation_error(self):\n qs.first()\n with self.assertRaisesMessage(TypeError, msg % \"last\"):\n qs.last()\n+\n+ def test_first_last_empty_order_by_has_no_pk_ordering(self):\n+ Article.objects.create(\n+ headline=\"Article 1\",\n+ pub_date=datetime(2006, 9, 10),\n+ expire_date=datetime(2056, 9, 11),\n+ )\n+\n+ qs = Article.objects.order_by()\n+ with patch.object(type(qs), \"order_by\") as mock_order_by:\n+ qs.first()\n+ mock_order_by.assert_not_called()\n+ qs.last()\n+ mock_order_by.assert_not_called()\n+\n+ def test_first_last_empty_order_by_clears_default_ordering(self):\n+ OrderedArticle.objects.create(\n+ headline=\"Article 1\",\n+ pub_date=datetime(2006, 9, 10),\n+ )\n+\n+ qs = OrderedArticle.objects.order_by()\n+ with patch.object(type(qs), \"order_by\") as mock_order_by:\n+ qs.first()\n+ mock_order_by.assert_not_called()\n+ qs.last()\n+ mock_order_by.assert_not_called()"
+ },
+ {
+ "filename": "tests/queries/test_qs_combinators.py",
+ "status": "modified",
+ "additions": 9,
+ "deletions": 0,
+ "changes": 9,
+ "patch": "@@ -418,6 +418,15 @@ def test_union_with_first(self):\n qs2 = base_qs.filter(name=\"a2\")\n self.assertEqual(qs1.union(qs2).first(), a1)\n \n+ [USER_REDACTED](\"supports_slicing_ordering_in_compound\")\n+ def test_union_applies_default_ordering_afterward(self):\n+ c = Tag.objects.create(name=\"C\")\n+ Tag.objects.create(name=\"B\")\n+ a = Tag.objects.create(name=\"A\")\n+ qs1 = Tag.objects.filter(name__in=[\"A\", \"B\"])[:1]\n+ qs2 = Tag.objects.filter(name__in=[\"C\"])[:1]\n+ self.assertSequenceEqual(qs1.union(qs2), [a, c])\n+\n def test_union_multiple_models_with_values_list_and_order(self):\n reserved_name = ReservedName.objects.create(name=\"rn1\", order=0)\n qs1 = Celebrity.objects.all()"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3717417880,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED] 👍 \n\nI have initial comments for you.",
+ "submitted_at": "2026-01-28T15:45:25+00:00"
+ },
+ {
+ "id": 3717514441,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T15:53:08+00:00"
+ },
+ {
+ "id": 3717729011,
+ "user": "user_057de2f3b132",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T16:31:44+00:00"
+ },
+ {
+ "id": 3718056748,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T17:31:57+00:00"
+ },
+ {
+ "id": 3718108107,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T17:44:47+00:00"
+ },
+ {
+ "id": 3718636110,
+ "user": "user_057de2f3b132",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T19:18:51+00:00"
+ },
+ {
+ "id": 3718658211,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-28T19:22:52+00:00"
+ },
+ {
+ "id": 3757741364,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-05T15:13:36+00:00"
+ },
+ {
+ "id": 3757847192,
+ "user": "user_d96dcc7f8ae4",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-05T15:32:53+00:00"
+ },
+ {
+ "id": 3757979051,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-05T15:55:22+00:00"
+ },
+ {
+ "id": 3759777262,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks [USER_REDACTED], this looks great ✅ .\n\nI segregated out the `union()` stuff since that was a separate bug we had to solve first. I also rewrote your test to actually perform queries and more clearly demonstrate that default orders were not applied after `union()`.",
+ "submitted_at": "2026-02-05T22:26:59+00:00"
+ },
+ {
+ "id": 3759806798,
+ "user": "user_057de2f3b132",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-02-05T22:37:44+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2737233490,
+ "user": "user_3a67c55598c5",
+ "body": "Need release notes and deprecation entries, see https://docs.djangoproject.com/en/6.0/internals/contributing/writing-code/submitting-patches/#deprecating-a-feature.",
+ "path": "django/db/models/query.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:37:02+00:00"
+ },
+ {
+ "id": 2737248463,
+ "user": "user_3a67c55598c5",
+ "body": "first() and last() returning the same object because only one object exists is a little non-intuitive for me when reading this test.",
+ "path": "tests/get_earliest_or_latest/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:40:10+00:00"
+ },
+ {
+ "id": 2737252468,
+ "user": "user_3a67c55598c5",
+ "body": "Can you add another test method showing what happens when a model has a default ordering as mentioned in the ticket?",
+ "path": "tests/get_earliest_or_latest/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:41:00+00:00"
+ },
+ {
+ "id": 2737268074,
+ "user": "user_3a67c55598c5",
+ "body": "I can deindent this without any failures.",
+ "path": "django/db/models/query.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:44:02+00:00"
+ },
+ {
+ "id": 2737311179,
+ "user": "user_3a67c55598c5",
+ "body": "[USER_REDACTED] the main reason I suggested the deprecation path was because of this test case.\n\nLooking again, perhaps we can look through the other end of the telescope here and make `first()`/`last()` have no change for union()/combinators instead.\n\nThe idea would be:\n```py\n.order_by().first() # no pk ordering, forced order clear\n# teach .union() to forget about whatever forced order clearing came before\nqs2.order_by().union(qs1).first() # still has a pk ordering, since we forgot about the forced order clear before union()\nqs2.order_by().union(qs1).order_by().first() # no pk ordering, ordering was force-cleared after union()\n```\nWDYT?\n\n[USER_REDACTED] you might want to pause on polishing the deprecation path to allow a little time for this discussion :-)",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T15:53:08+00:00"
+ },
+ {
+ "id": 2737484059,
+ "user": "user_057de2f3b132",
+ "body": "Hmm, interesting.\n\nFrom an SQL point of view it looks like there's only ever an ordering applied to the whole union not to sub-parts (unless I'm missing something). In that case, I'm happy with your proposed behaviour.\n\nIt might also be worthwhile to warn about explicit `order_by` calls on either of the `union` querysets (i.e. `qs1` and `qs2` in your example), since these will always be ignored.\n\nOn the point of deprecation, I'm happy for the default behaviour to be a deprecation warning, but I'd like to also have a way to opt-in to the future behaviour (via a setting or maybe an attribute on the queryset or something).",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T16:31:43+00:00"
+ },
+ {
+ "id": 2737745249,
+ "user": "user_3a67c55598c5",
+ "body": "Cool. So in that case, we don't need deprecation warnings relating to the order_by() <--> first() interaction, because we found a way to solve the ticket without mucking with this union() test case.\n\nA tangential finding here about the order_by() <--> union() interaction might be worth a deprecation path to eventually lead to raising an error, but we don't need to tackle that here.\n\nDoes that make sense [USER_REDACTED]?",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T17:31:57+00:00"
+ },
+ {
+ "id": 2737790455,
+ "user": "user_3a67c55598c5",
+ "body": "> A tangential finding here about the order_by() <--> union() interaction might be worth a deprecation path to eventually lead to raising an error, but we don't need to tackle that here.\n\nActually, we don't even need that, the reason these examples have `order_by()` before `.union()` is to clear a default ordering from the queryset, which is good, because otherwise `.union()` throws. So nothing to deprecate and nothing to raise an error for.\n\nThe question here is just how to disambiguate that from \"please don't order my final result after the union\".",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T17:44:47+00:00"
+ },
+ {
+ "id": 2738196002,
+ "user": "user_057de2f3b132",
+ "body": "I think `qs2.union(qs1).first()` should be \"apply pk ordering\" and `qs2.union(qs1).order_by().first()` should be \"apply no ordering\". (With extra `.order_by()` on `qs1` or `qs2` as necessary.)",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T19:18:51+00:00"
+ },
+ {
+ "id": 2738215019,
+ "user": "user_3a67c55598c5",
+ "body": "Wonderful, I agree. So [USER_REDACTED], we should leave the original test case as is to capture Lily's first case, and then add an assertion to capture Lily's second case.",
+ "path": "tests/queries/test_qs_combinators.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-01-28T19:22:52+00:00"
+ },
+ {
+ "id": 2769690073,
+ "user": "user_3a67c55598c5",
+ "body": "This won't fail if the code change is undone; we'll need something else, e.g. mocking `order_by()` and calling `assert_not_called`.",
+ "path": "tests/get_earliest_or_latest/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-05T15:13:36+00:00"
+ },
+ {
+ "id": 2769784169,
+ "user": "user_d96dcc7f8ae4",
+ "body": "Thanks for the review! I’m aware of this and already working on the suggested changes. I’ll request another review once everything is ready.",
+ "path": "tests/get_earliest_or_latest/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-05T15:32:53+00:00"
+ },
+ {
+ "id": 2769897688,
+ "user": "user_3a67c55598c5",
+ "body": "No problem, sorry for jumping the gun 👍",
+ "path": "tests/get_earliest_or_latest/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-05T15:55:22+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 10,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 13,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 13
+ }
+}
+{
+ "_id": "0b202cfe0094fae8",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20455,
+ "title": "Added DatabaseFeatures.supports_inspectdb.",
+ "body": "Needed by MongoDB.",
+ "author": "user_657e90e5ae46",
+ "created_at": "2025-12-24T01:37:59+00:00",
+ "merged_at": "2026-02-09T22:46:33+00:00",
+ "base_branch": "main",
+ "head_branch": "DatabaseFeatures.supports_inspectdb",
+ "additions": 29,
+ "deletions": 4,
+ "changed_files": 5,
+ "files": [
+ {
+ "filename": "django/core/management/commands/inspectdb.py",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 2,
+ "changes": 4,
+ "patch": "@@ -44,10 +44,10 @@ def add_arguments(self, parser):\n )\n \n def handle(self, **options):\n- try:\n+ if connections[options[\"database\"]].features.supports_inspectdb:\n for line in self.handle_inspection(options):\n self.stdout.write(line)\n- except NotImplementedError:\n+ else:\n raise CommandError(\n \"Database inspection isn't supported for the currently selected \"\n \"database backend.\""
+ },
+ {
+ "filename": "django/db/backends/base/features.py",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -400,6 +400,9 @@ class BaseDatabaseFeatures:\n supports_on_delete_db_default = True\n supports_on_delete_db_null = True\n \n+ # Does the backend support the inspectdb management command?\n+ supports_inspectdb = True\n+\n # Collation names for use by [NAME_REDACTED]\n test_collations = {\n \"ci\": None, # Case-insensitive."
+ },
+ {
+ "filename": "docs/releases/6.1.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 0,
+ "changes": 3,
+ "patch": "@@ -367,6 +367,9 @@ backends.\n ``db_on_delete``) as values. ``db_on_delete`` is one of the database-level\n delete options e.g. :attr:`~django.db.models.DB_CASCADE`.\n \n+* Set the new ``DatabaseFeatures.supports_inspectdb`` attribute to ``False``\n+ if the management command isn't supported.\n+\n :mod:`django.contrib.gis`\n -------------------------"
+ },
+ {
+ "filename": "tests/gis_tests/inspectapp/tests.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -14,6 +14,7 @@\n from .models import AllOGRFields\n \n \n+[USER_REDACTED](\"supports_inspectdb\")\n class InspectDbTests(TestCase):\n def test_geom_columns(self):\n \"\"\""
+ },
+ {
+ "filename": "tests/inspectdb/tests.py",
+ "status": "modified",
+ "additions": 20,
+ "deletions": 2,
+ "changes": 22,
+ "patch": "@@ -2,11 +2,16 @@\n from io import StringIO\n from unittest import mock, skipUnless\n \n-from django.core.management import call_command\n+from django.core.management import CommandError, call_command\n from django.core.management.commands import inspectdb\n from django.db import connection\n from django.db.backends.base.introspection import TableInfo\n-from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature\n+from django.test import (\n+ TestCase,\n+ TransactionTestCase,\n+ skipIfDBFeature,\n+ skipUnlessDBFeature,\n+)\n \n from .models import PeopleMoreData, test_collation\n \n@@ -40,6 +45,7 @@ def cursor_execute(*queries):\n return results\n \n \n+[USER_REDACTED](\"supports_inspectdb\")\n class InspectDBTestCase(TestCase):\n unique_re = re.compile(r\".*unique_together = \\((.+),\\).*\")\n \n@@ -519,6 +525,7 @@ def test_same_relations(self):\n )\n \n \n+[USER_REDACTED](\"supports_inspectdb\")\n class InspectDBTransactionalTests(TransactionTestCase):\n available_apps = [\"inspectdb\"]\n \n@@ -671,3 +678,14 @@ def test_composite_primary_key_not_unique_together(self):\n out = StringIO()\n call_command(\"inspectdb\", \"inspectdb_compositepkmodel\", stdout=out)\n self.assertNotIn(\"unique_together\", out.getvalue())\n+\n+\n+[USER_REDACTED](\"supports_inspectdb\")\n+class InspectDBNotSupportedTests(TestCase):\n+ def test_not_supported(self):\n+ msg = (\n+ \"Database inspection isn't supported for the currently selected \"\n+ \"database backend.\"\n+ )\n+ with self.assertRaisesMessage(CommandError, msg):\n+ call_command(\"inspectdb\")"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3609673130,
+ "user": "user_657e90e5ae46",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-24T01:39:13+00:00"
+ },
+ {
+ "id": 3756970500,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-02-05T13:06:16+00:00"
+ },
+ {
+ "id": 3775630452,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2026-02-09T22:04:41+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2644568610,
+ "user": "user_657e90e5ae46",
+ "body": "This matches what `inspectdb` does:\nhttps://github.com/[USER_REDACTED]ngo/django/blob/68859a9b45f0b9d472c9277dc61e54afacc0da38/django/core/management/commands/inspectdb.py#L47-L54\nI debated whether to use this implementation or to make it a boolean that the developer has to set to opt out. I could be convinced either way.",
+ "path": "django/db/backends/base/features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-24T01:39:13+00:00"
+ },
+ {
+ "id": 2769063466,
+ "user": "user_3a67c55598c5",
+ "body": "Interesting. I checked the blame, and at the time this was added the only backend that raised `NotImplementedError` from `get_table_names()` was the since-removed backend for ADO MSSQL:\n\nhttps://github.com/[USER_REDACTED]ngo/django/blob/6d210ef40341b26aa2881fbb82ef7a7cdd54a3df/django/core/db/backends/ado_mssql.py#L112-L113\n\nWe could probably make the flag a boolean and then do a cleanup in `inspectdb` to replace this except with a check on that flag. wdyt?",
+ "path": "django/db/backends/base/features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2026-02-05T13:06:16+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 2,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "bb9095d0d1a81964",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20448,
+ "title": "Bumped linter dependencies",
+ "body": "#### Trac ticket number\n\nNone. I can create one if we think it's necessary.\n\n#### Branch description\nUpdates the linters.\n\n* psf/black-pre-commit-mirror: 25.9.0 -> 25.12.0\n* pre-commit/mirrors-eslint: v9.36.0 -> v9.39.1\n* zizmorcore/zizmor-pre-commit: v1.16.3 -> v1.19.0\n* zizmorcore/zizmor-action: 0.2.0 -> 0.3.0\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [ ] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [ ] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_f575e6dfca7f",
+ "created_at": "2025-12-23T01:20:12+00:00",
+ "merged_at": "2026-01-12T13:57:36+00:00",
+ "base_branch": "main",
+ "head_branch": "bump-linter-dependencies",
+ "additions": 5,
+ "deletions": 5,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": ".github/workflows/linters.yml",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -79,7 +79,7 @@ jobs:\n with:\n persist-credentials: false\n - name: Run zizmor\n- uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0\n+ uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0\n with:\n advanced-security: false\n annotations: true"
+ },
+ {
+ "filename": ".pre-commit-config.yaml",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 4,
+ "changes": 8,
+ "patch": "@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/psf/black-pre-commit-mirror\n- rev: 25.9.0\n+ rev: 25.12.0\n hooks:\n - id: black\n exclude: \\.py-tpl$\n@@ -9,7 +9,7 @@ repos:\n hooks:\n - id: blacken-docs\n additional_dependencies:\n- - black==25.9.0\n+ - black==25.12.0\n files: 'docs/.*\\.txt$'\n args: [\"--rst-literal-block\"]\n - repo: https://github.com/PyCQA/isort\n@@ -21,10 +21,10 @@ repos:\n hooks:\n - id: flake8\n - repo: https://github.com/pre-commit/mirrors-eslint\n- rev: v9.36.0\n+ rev: v9.39.1\n hooks:\n - id: eslint\n - repo: https://github.com/zizmorcore/zizmor-pre-commit\n- rev: v1.16.3 \n+ rev: v1.19.0\n hooks:\n - id: zizmor"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3650896821,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks 👍",
+ "submitted_at": "2026-01-12T13:57:00+00:00"
+ },
+ {
+ "id": 3651926456,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-12T17:36:38+00:00"
+ },
+ {
+ "id": 3662452823,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2026-01-14T19:42:10+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2683244097,
+ "user": "user_5501cd6d3dc8",
+ "body": "This should also be updated in the `package.json`.",
+ "path": ".pre-commit-config.yaml",
+ "line": 24,
+ "side": "RIGHT",
+ "created_at": "2026-01-12T17:36:38+00:00"
+ },
+ {
+ "id": 2691792468,
+ "user": "user_3a67c55598c5",
+ "body": "Gotcha, see #20537.",
+ "path": ".pre-commit-config.yaml",
+ "line": 24,
+ "side": "RIGHT",
+ "created_at": "2026-01-14T19:42:10+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "yaml",
+ "yml"
+ ],
+ "touches_tests": false,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 2
+ },
+ "meaningful_comment_count": 2,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 2
+ }
+}
+{
+ "_id": "fe274e0195e20c3e",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20445,
+ "title": "Refs #24920 -- [NAME_REDACTED] system checks database dependent.",
+ "body": "[NAME_REDACTED] for the suggestion.\n\nticket-24920",
+ "author": "user_5501cd6d3dc8",
+ "created_at": "2025-12-22T19:32:54+00:00",
+ "merged_at": "2025-12-28T18:21:49+00:00",
+ "base_branch": "main",
+ "head_branch": "24920-checks",
+ "additions": 63,
+ "deletions": 52,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/db/models/fields/__init__.py",
+ "status": "modified",
+ "additions": 57,
+ "deletions": 46,
+ "changes": 103,
+ "patch": "@@ -1715,40 +1715,46 @@ def __init__(\n \n def check(self, **kwargs):\n errors = super().check(**kwargs)\n+ databases = kwargs.get(\"databases\") or []\n \n digits_errors = [\n- *self._check_decimal_places(),\n- *self._check_max_digits(),\n+ *self._check_decimal_places(databases),\n+ *self._check_max_digits(databases),\n ]\n if not digits_errors:\n errors.extend(self._check_decimal_places_and_max_digits(**kwargs))\n else:\n errors.extend(digits_errors)\n return errors\n \n- def _check_decimal_places(self):\n+ def _check_decimal_places(self, databases):\n if self.decimal_places is None:\n- if (\n- not connection.features.supports_no_precision_decimalfield\n- and \"supports_no_precision_decimalfield\"\n- not in self.model._meta.required_db_features\n- ):\n- return [\n- checks.Error(\n- \"DecimalFields must define a 'decimal_places' attribute.\",\n- obj=self,\n- id=\"fields.E130\",\n- )\n- ]\n- elif self.max_digits is not None:\n- return [\n- checks.Error(\n- \"DecimalField’s max_digits and decimal_places must both \"\n- \"be defined or both omitted.\",\n- obj=self,\n- id=\"fields.E135\",\n- ),\n- ]\n+ for db in databases:\n+ if not router.allow_migrate_model(db, self.model):\n+ continue\n+ connection = connections[db]\n+\n+ if (\n+ not connection.features.supports_no_precision_decimalfield\n+ and \"supports_no_precision_decimalfield\"\n+ not in self.model._meta.required_db_features\n+ ):\n+ return [\n+ checks.Error(\n+ \"DecimalFields must define a 'decimal_places' attribute.\",\n+ obj=self,\n+ id=\"fields.E130\",\n+ )\n+ ]\n+ elif self.max_digits is not None:\n+ return [\n+ checks.Error(\n+ \"DecimalField’s max_digits and decimal_places must both \"\n+ \"be defined or both omitted.\",\n+ obj=self,\n+ id=\"fields.E135\",\n+ ),\n+ ]\n else:\n try:\n decimal_places = int(self.decimal_places)\n@@ -1764,29 +1770,34 @@ def _check_decimal_places(self):\n ]\n return []\n \n- def _check_max_digits(self):\n+ def _check_max_digits(self, databases):\n if self.max_digits is None:\n- if (\n- not connection.features.supports_no_precision_decimalfield\n- and \"supports_no_precision_decimalfield\"\n- not in self.model._meta.required_db_features\n- ):\n- return [\n- checks.Error(\n- \"DecimalFields must define a 'max_digits' attribute.\",\n- obj=self,\n- id=\"fields.E132\",\n- )\n- ]\n- elif self.decimal_places is not None:\n- return [\n- checks.Error(\n- \"DecimalField’s max_digits and decimal_places must both \"\n- \"be defined or both omitted.\",\n- obj=self,\n- id=\"fields.E135\",\n- ),\n- ]\n+ for db in databases:\n+ if not router.allow_migrate_model(db, self.model):\n+ continue\n+ connection = connections[db]\n+\n+ if (\n+ not connection.features.supports_no_precision_decimalfield\n+ and \"supports_no_precision_decimalfield\"\n+ not in self.model._meta.required_db_features\n+ ):\n+ return [\n+ checks.Error(\n+ \"DecimalFields must define a 'max_digits' attribute.\",\n+ obj=self,\n+ id=\"fields.E132\",\n+ )\n+ ]\n+ elif self.decimal_places is not None:\n+ return [\n+ checks.Error(\n+ \"DecimalField’s max_digits and decimal_places must both \"\n+ \"be defined or both omitted.\",\n+ obj=self,\n+ id=\"fields.E135\",\n+ ),\n+ ]\n else:\n try:\n max_digits = int(self.max_digits)"
+ },
+ {
+ "filename": "tests/invalid_models_tests/test_ordinary_fields.py",
+ "status": "modified",
+ "additions": 6,
+ "deletions": 6,
+ "changes": 12,
+ "patch": "@@ -620,7 +620,7 @@ class Model(models.Model):\n id=\"fields.E132\",\n ),\n ]\n- self.assertEqual(field.check(), expected)\n+ self.assertEqual(field.check(databases=self.databases), expected)\n \n def test_both_attributes_omitted_required_db_features(self):\n class Model(models.Model):\n@@ -639,7 +639,7 @@ class Model(models.Model):\n \n field = Model._meta.get_field(\"field\")\n self.assertEqual(\n- field.check(),\n+ field.check(databases=self.databases),\n [\n Error(\n \"DecimalField’s max_digits and decimal_places must both \"\n@@ -657,7 +657,7 @@ class Model(models.Model):\n \n field = Model._meta.get_field(\"field\")\n self.assertEqual(\n- field.check(),\n+ field.check(databases=self.databases),\n [\n Error(\n \"DecimalField’s max_digits and decimal_places must both \"\n@@ -674,7 +674,7 @@ class Model(models.Model):\n \n field = Model._meta.get_field(\"field\")\n self.assertEqual(\n- field.check(),\n+ field.check(databases=self.databases),\n [\n Error(\n \"'decimal_places' must be a non-negative integer.\",\n@@ -695,7 +695,7 @@ class Model(models.Model):\n \n field = Model._meta.get_field(\"field\")\n self.assertEqual(\n- field.check(),\n+ field.check(databases=self.databases),\n [\n Error(\n \"'decimal_places' must be a non-negative integer.\",\n@@ -731,7 +731,7 @@ class Model(models.Model):\n field = models.DecimalField(max_digits=10, decimal_places=10)\n \n field = Model._meta.get_field(\"field\")\n- self.assertEqual(field.check(), [])\n+ self.assertEqual(field.check(databases=self.databases), [])\n \n \n [USER_REDACTED]_apps(\"invalid_models_tests\")"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3609292504,
+ "user": "user_606ba1f2b93c",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-12-23T20:48:31+00:00"
+ },
+ {
+ "id": 3609294238,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-23T20:50:09+00:00"
+ },
+ {
+ "id": 3609312884,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-23T20:58:21+00:00"
+ },
+ {
+ "id": 3609319896,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-23T21:00:32+00:00"
+ },
+ {
+ "id": 3614772829,
+ "user": "user_cdda8932ec17",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-12-28T17:48:46+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2644234920,
+ "user": "user_cdda8932ec17",
+ "body": "Any thoughts about moving this skip to `check`? I wonder if it might be worth adjusting `Model.check` to eventually skip delegation when `not router.allow_migrate_model(db, self.model)`.",
+ "path": "django/db/models/fields/__init__.py",
+ "line": 1734,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T20:49:33+00:00"
+ },
+ {
+ "id": 2644235375,
+ "user": "user_cdda8932ec17",
+ "body": "I think you're missing `connection = connections[db]` here?",
+ "path": "django/db/models/fields/__init__.py",
+ "line": 1777,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T20:49:50+00:00"
+ },
+ {
+ "id": 2644249178,
+ "user": "user_5501cd6d3dc8",
+ "body": "The second branch (when `decimal_places` is not `None`) should always run, that's why I put it here.",
+ "path": "django/db/models/fields/__init__.py",
+ "line": 1734,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T20:58:21+00:00"
+ },
+ {
+ "id": 2644252759,
+ "user": "user_5501cd6d3dc8",
+ "body": "Yes, good catch :dart: Silly me :)",
+ "path": "django/db/models/fields/__init__.py",
+ "line": 1777,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T21:00:32+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 2,
+ "COMMENTED": 3
+ },
+ "meaningful_comment_count": 4,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 4
+ }
+}
+{
+ "_id": "35b3c2a253dc27c4",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20443,
+ "title": "Fixed #36818 -- Ensured SQLite connection before accessing max_query_params.",
+ "body": "Ensure that the SQLite database connection is established before accessing\nDatabaseFeatures.max_query_params.\n\nThis fixes a regression where calling QuerySet.bulk_create() as the first\ndatabase operation after django.setup() could raise an AttributeError on\nSQLite due to an uninitialized connection.\n\n#### Trac ticket number\nticket-36818\n\n#### Branch description\nSQLite's DatabaseFeatures.max_query_params accessed the underlying DB-API\nconnection without ensuring it was initialized. This change calls\nensure_connection() before querying the SQLite variable limit, preventing\nAttributeError when backend features are accessed prior to any SQL execution.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_efaa7460429a",
+ "created_at": "2025-12-22T15:56:10+00:00",
+ "merged_at": "2025-12-23T01:33:13+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36818_sqlite_max_query_params",
+ "additions": 16,
+ "deletions": 0,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "django/db/backends/sqlite3/features.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 0,
+ "changes": 1,
+ "patch": "@@ -157,6 +157,7 @@ def max_query_params(self):\n 32766) or lowered per connection at run-time with\n setlimit(SQLITE_LIMIT_VARIABLE_NUMBER, N).\n \"\"\"\n+ self.connection.ensure_connection()\n return self.connection.connection.getlimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER)\n \n [USER_REDACTED]_property"
+ },
+ {
+ "filename": "docs/releases/6.0.1.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -20,3 +20,7 @@ Bugfixes\n * Fixed a bug where management command colorized help (introduced in\n Python 3.14) ignored the :option:`--no-color` option and the\n :envvar:`DJANGO_COLORS` setting (:ticket:`36376`).\n+\n+* Fixed a regression in Django 6.0 that caused\n+ :meth:`~django.db.models.query.QuerySet.bulk_create` to crash\n+ when introspecting the connection on SQLite (:ticket:`36818`)."
+ },
+ {
+ "filename": "tests/backends/sqlite/test_features.py",
+ "status": "modified",
+ "additions": 11,
+ "deletions": 0,
+ "changes": 11,
+ "patch": "@@ -1,3 +1,4 @@\n+import copy\n import sqlite3\n from unittest import mock, skipUnless\n \n@@ -29,3 +30,13 @@ def test_max_query_params_respects_variable_limit(self):\n finally:\n connection.connection.setlimit(limit_name, current_limit)\n self.assertEqual(connection.features.max_query_params, current_limit)\n+\n+ def test_max_query_params_without_established_connection(self):\n+ new_connection = connection.copy()\n+ new_connection.settings_dict = copy.deepcopy(connection.settings_dict)\n+ self.assertIsNone(new_connection.connection)\n+ try:\n+ result = new_connection.features.max_query_params\n+ self.assertIsInstance(result, int)\n+ finally:\n+ new_connection._close()"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3604722222,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T16:16:01+00:00"
+ },
+ {
+ "id": 3604901241,
+ "user": "user_cdda8932ec17",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T17:08:25+00:00"
+ },
+ {
+ "id": 3604930609,
+ "user": "user_efaa7460429a",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T17:15:43+00:00"
+ },
+ {
+ "id": 3604937107,
+ "user": "user_cdda8932ec17",
+ "state": "APPROVED",
+ "body": "Thanks for PR [USER_REDACTED], really appreciated!\n\nFeel free to add yourself to `AUTHORS` if you'd like to, I'll mark the patch as RFC.",
+ "submitted_at": "2025-12-22T17:17:22+00:00"
+ },
+ {
+ "id": 3605464349,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T19:36:53+00:00"
+ },
+ {
+ "id": 3606198477,
+ "user": "user_efaa7460429a",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-23T01:03:10+00:00"
+ },
+ {
+ "id": 3606239904,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thanks 👍",
+ "submitted_at": "2025-12-23T01:30:08+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2640428474,
+ "user": "user_cdda8932ec17",
+ "body": "Refer to 358fd21c47cdf7bda520ce73c5cfd82bba57827b and where the original test was added in `tests/backends/sqlite/test_features.py`.\n\nThe way this is currently defined the test is running on all backend when it should be SQLite specific.\n\nhttps://github.com/[USER_REDACTED]ngo/django/commit/358fd21c47cdf7bda520ce73c5cfd82bba57827b#diff-bcc4842c09fdfbe9666b5d295f56846226e72148b015e0c19d4fc4ebd570b202R14-R22",
+ "path": "tests/backends/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T16:16:00+00:00"
+ },
+ {
+ "id": 2640565587,
+ "user": "user_cdda8932ec17",
+ "body": "```suggestion\n* Fixed a regression in Django 6.0 that caused\n :meth:`~django.db.models.query.QuerySet.bulk_create` to crash\n when introspecting the connection on SQLite (:ticket:`36818`).\n```\n\nThe problem is not only present if it's the first operation after `django.setup` as we also close connections between requests and the code was not ensuring the connection was opened either.",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T17:08:25+00:00"
+ },
+ {
+ "id": 2640587515,
+ "user": "user_efaa7460429a",
+ "body": "Updated the release notes as suggested.",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T17:15:43+00:00"
+ },
+ {
+ "id": 2641021306,
+ "user": "user_3a67c55598c5",
+ "body": "I'm getting the following, when using an in-memory database:\n\n```py\nResourceWarning: unclosed database in \n```\nIt goes away with:\n```suggestion\n new_connection._close()\n```",
+ "path": "tests/backends/sqlite/test_features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T19:36:54+00:00"
+ },
+ {
+ "id": 2641632711,
+ "user": "user_efaa7460429a",
+ "body": "Thanks for the suggestion. I've updated the code to use `_close()` to ensure the underlying connection is properly closed in all environments.",
+ "path": "tests/backends/sqlite/test_features.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T01:03:10+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 5,
+ "APPROVED": 2
+ },
+ "meaningful_comment_count": 5,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 5
+ }
+}
+{
+ "_id": "2db924b91f6551ba",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20437,
+ "title": "Fixed #36787 -- Fixed crash in In lookups with mixed expressions and strings.",
+ "body": "#### Trac ticket number\n\n\nticket-36787\n\nThank you for providing the test code, [USER_REDACTED] \n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_ed8298a0306d",
+ "created_at": "2025-12-21T13:38:38+00:00",
+ "merged_at": "2025-12-22T19:25:45+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket-36787",
+ "additions": 9,
+ "deletions": 1,
+ "changed_files": 2,
+ "files": [
+ {
+ "filename": "django/db/models/lookups.py",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -295,7 +295,7 @@ def get_prep_lookup(self):\n (\n value\n if hasattr(value, \"resolve_expression\")\n- else Value(value, self.lhs.output_field)\n+ else Value(value, getattr(self.lhs, \"output_field\", None))\n )\n for value in self.rhs\n ]"
+ },
+ {
+ "filename": "tests/lookup/tests.py",
+ "status": "modified",
+ "additions": 8,
+ "deletions": 0,
+ "changes": 8,
+ "patch": "@@ -1855,6 +1855,14 @@ def test_in_lookup_in_filter(self):\n Season.objects.filter(In(F(\"year\"), years)).order_by(\"pk\"), seasons\n )\n \n+ def test_in_lookup_in_filter_text_field(self):\n+ self.assertSequenceEqual(\n+ Season.objects.filter(\n+ In(F(\"nulled_text_field\"), [F(\"nulled_text_field\"), \"special_value\"])\n+ ),\n+ [self.s2],\n+ )\n+\n def test_filter_lookup_lhs(self):\n qs = Season.objects.annotate(before_20=LessThan(F(\"year\"), 2000)).filter(\n before_20=LessThan(F(\"year\"), 1900),"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3604310626,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thank you!",
+ "submitted_at": "2025-12-22T14:33:17+00:00"
+ },
+ {
+ "id": 3609305095,
+ "user": "user_5501cd6d3dc8",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-23T20:55:32+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2644244696,
+ "user": "user_5501cd6d3dc8",
+ "body": "This test crashes on Oracle because blob fields (e.g. `NCLOB`) are not allowed in the `IN()` clause. As far as I'm aware `TextFields` are unnecessary here, see #20453.",
+ "path": "tests/lookup/tests.py",
+ "line": 1864,
+ "side": "RIGHT",
+ "created_at": "2025-12-23T20:55:32+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "APPROVED": 1,
+ "COMMENTED": 1
+ },
+ "meaningful_comment_count": 1,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 1
+ }
+}
+{
+ "_id": "6804ccd8191289b9",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.577805+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20422,
+ "title": "Fixed #36376 -- Fixed color suppression in argparse help on Python 3.14+.",
+ "body": "#### Trac ticket number\n\n\nticket-36376\n\n#### Branch description\nThis adds the argparse's colorized help feature for Django management commands when running on Python 3.14 or higher as suggested in the above mentioned ticket.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_f5eee7dbaa84",
+ "created_at": "2025-12-18T11:13:05+00:00",
+ "merged_at": "2025-12-22T19:02:21+00:00",
+ "base_branch": "main",
+ "head_branch": "fix36376",
+ "additions": 40,
+ "deletions": 3,
+ "changed_files": 4,
+ "files": [
+ {
+ "filename": "django/core/management/base.py",
+ "status": "modified",
+ "additions": 5,
+ "deletions": 2,
+ "changes": 7,
+ "patch": "@@ -58,8 +58,11 @@ def __init__(\n ):\n self.missing_args_message = missing_args_message\n self.called_from_command_line = called_from_command_line\n- if PY314 and not PY315:\n- kwargs.setdefault(\"suggest_on_error\", True)\n+ if PY314:\n+ if not PY315:\n+ kwargs.setdefault(\"suggest_on_error\", True)\n+ if os.environ.get(\"DJANGO_COLORS\") == \"nocolor\" or \"--no-color\" in sys.argv:\n+ kwargs.setdefault(\"color\", False)\n super().__init__(**kwargs)\n \n def parse_args(self, args=None, namespace=None):"
+ },
+ {
+ "filename": "docs/releases/5.2.10.txt",
+ "status": "modified",
+ "additions": 3,
+ "deletions": 1,
+ "changes": 4,
+ "patch": "@@ -9,4 +9,6 @@ Django 5.2.10 fixes several bugs in 5.2.9.\n Bugfixes\n ========\n \n-* ...\n+* Fixed a bug where management command colorized help (introduced in\n+ Python 3.14) ignored the :option:`--no-color` option and the\n+ :envvar:`DJANGO_COLORS` setting (:ticket:`36376`)."
+ },
+ {
+ "filename": "docs/releases/6.0.1.txt",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -16,3 +16,7 @@ Bugfixes\n * Fixed a regression in Django 6.0 that prevented changing the name of a\n :class:`~django.db.models.ManyToManyField` from taking effect when applying\n migrations (:ticket:`36800`).\n+\n+* Fixed a bug where management command colorized help (introduced in\n+ Python 3.14) ignored the :option:`--no-color` option and the\n+ :envvar:`DJANGO_COLORS` setting (:ticket:`36376`)."
+ },
+ {
+ "filename": "tests/user_commands/tests.py",
+ "status": "modified",
+ "additions": 28,
+ "deletions": 0,
+ "changes": 28,
+ "patch": "@@ -470,6 +470,34 @@ def test_suggest_on_error_explicit_false(self):\n )\n self.assertFalse(parser.suggest_on_error)\n \n+ [USER_REDACTED].skipUnless(PY314, \"Only relevant for Python 3.14+\")\n+ def test_color_enabled_by_default(self):\n+ with mock.patch.dict(os.environ, {}, clear=True):\n+ command = BaseCommand()\n+ parser = command.create_parser(\"prog_name\", \"subcommand\")\n+ self.assertTrue(parser.color)\n+\n+ [USER_REDACTED].skipUnless(PY314, \"Only relevant for Python 3.14+\")\n+ def test_color_disabled_with_django_colors_nocolor(self):\n+ with mock.patch.dict(os.environ, {\"DJANGO_COLORS\": \"nocolor\"}):\n+ command = BaseCommand()\n+ parser = command.create_parser(\"prog_name\", \"subcommand\")\n+ self.assertFalse(parser.color)\n+\n+ [USER_REDACTED].skipUnless(PY314, \"Only relevant for Python 3.14+\")\n+ def test_force_color_does_not_affect_argparse_color(self):\n+ with mock.patch.dict(os.environ, {}, clear=True):\n+ command = BaseCommand(force_color=True)\n+ parser = command.create_parser(\"prog_name\", \"subcommand\")\n+ self.assertTrue(parser.color)\n+\n+ [USER_REDACTED].skipUnless(PY314, \"Only relevant for Python 3.14+\")\n+ def test_no_color_flag_disables_color(self):\n+ with mock.patch.object(sys, \"argv\", [\"manage.py\", \"mycommand\", \"--no-color\"]):\n+ command = BaseCommand()\n+ parser = command.create_parser(\"manage.py\", \"mycommand\")\n+ self.assertFalse(parser.color)\n+\n \n class CommandRunTests(AdminScriptTestCase):\n \"\"\""
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3599771481,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks [USER_REDACTED] 🎁 \n\nI left a comment on the ticket about how this has now morphed into a bugfix since the ticket was opened. Could you address the feedback and add a release note for 6.0.1.txt?",
+ "submitted_at": "2025-12-19T19:54:02+00:00"
+ },
+ {
+ "id": 3601168177,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T16:09:53+00:00"
+ },
+ {
+ "id": 3604586999,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks for the updates, this looks really good. Only some very minor feedback for you.",
+ "submitted_at": "2025-12-22T16:10:39+00:00"
+ },
+ {
+ "id": 3605081597,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T17:49:13+00:00"
+ },
+ {
+ "id": 3605112538,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T17:55:45+00:00"
+ },
+ {
+ "id": 3605164148,
+ "user": "user_f5eee7dbaa84",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T18:07:32+00:00"
+ },
+ {
+ "id": 3605299220,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-22T18:47:07+00:00"
+ },
+ {
+ "id": 3605299681,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": null,
+ "submitted_at": "2025-12-22T18:47:13+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2636058702,
+ "user": "user_3a67c55598c5",
+ "body": "When the docstrings communicate the same information as the method names we chop them.",
+ "path": "tests/user_commands/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T19:25:31+00:00"
+ },
+ {
+ "id": 2636073803,
+ "user": "user_3a67c55598c5",
+ "body": "```suggestion\n```\nI don't think we need to bother; color is already True by [NAME_REDACTED]://github.com/python/cpython/pull/136809 (3.14)",
+ "path": "django/core/management/base.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T19:31:45+00:00"
+ },
+ {
+ "id": 2636085507,
+ "user": "user_3a67c55598c5",
+ "body": "This environment variable hasn't been set yet; we also need to check for an incoming ``--no-color`` argument instead. Please add a test.",
+ "path": "django/core/management/base.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T19:35:45+00:00"
+ },
+ {
+ "id": 2636096455,
+ "user": "user_3a67c55598c5",
+ "body": "I think we can remove this; this is more of a bugfix that we need to respect `--no-color` on python 3.14.",
+ "path": "docs/releases/6.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T19:40:36+00:00"
+ },
+ {
+ "id": 2637195075,
+ "user": "user_f5eee7dbaa84",
+ "body": "Point noted.",
+ "path": "tests/user_commands/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-20T16:09:53+00:00"
+ },
+ {
+ "id": 2640317786,
+ "user": "user_3a67c55598c5",
+ "body": "Great -- please duplicate this in 5.2.10.txt.",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T15:42:29+00:00"
+ },
+ {
+ "id": 2640394776,
+ "user": "user_3a67c55598c5",
+ "body": "Very minor: I'd use \"manage.py\" and \"mycommand\" to match the mock.",
+ "path": "tests/user_commands/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T16:02:55+00:00"
+ },
+ {
+ "id": 2640395530,
+ "user": "user_3a67c55598c5",
+ "body": "I'd make all 4 assertions use either assertIs or not.",
+ "path": "tests/user_commands/tests.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T16:03:12+00:00"
+ },
+ {
+ "id": 2640408428,
+ "user": "user_3a67c55598c5",
+ "body": "I think we should mention management commands up front, although it's fine to mention argparse in here.",
+ "path": "docs/releases/6.0.1.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T16:07:38+00:00"
+ },
+ {
+ "id": 2640716711,
+ "user": "user_3a67c55598c5",
+ "body": "Sorry I wasn't super clear -- we need a release note in both 5.2.10.txt and 6.0.1.txt.",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T17:49:13+00:00"
+ },
+ {
+ "id": 2640735716,
+ "user": "user_3a67c55598c5",
+ "body": "Also, \"management command\" isn't a code literal, so please avoid backticks.",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T17:55:45+00:00"
+ },
+ {
+ "id": 2640770270,
+ "user": "user_f5eee7dbaa84",
+ "body": "My bad , fixed it !",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T18:07:31+00:00"
+ },
+ {
+ "id": 2640882791,
+ "user": "user_3a67c55598c5",
+ "body": "No worries, thank you!",
+ "path": "docs/releases/5.2.10.txt",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-22T18:47:07+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py",
+ "txt"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 7,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 13,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 13
+ }
+}
+{
+ "_id": "1a93af7804af2f37",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.593428+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20420,
+ "title": "Fixed #36786 -- Fixed XML serialization of None values in natural keys.",
+ "body": "#### Trac ticket number\n\n\n[ticket-36786](https://code.djangoproject.com/ticket/36786)\n\n#### Branch description\n\n**AS-IS**:\n- `None` values in natural keys were serialized as the string `\"None\"`, causing deserialization to fail.\n\n**TO-BE**\n- `None` values are serialized as ` ` elements, consistent with how regular fields handle `None`.\n\n**Before**\n```python\n# Check for None first - but this matches inside tags too!\nif node.getElementsByTagName(\"None\"):\n return None\nelse:\n ...\n keys = node.getElementsByTagName(\"natural\")\n if keys:\n field_value = [getInnerText(k).strip() for k in keys]\n```\n\nAfter\n\n```python\nnatural_keys = node.getElementsByTagName(\"natural\")\nif node.getElementsByTagName(\"None\") and not natural_keys:\n return None\nelse:\n ...\n if natural_keys:\n field_value = []\n for k in natural_keys:\n if k.getElementsByTagName(\"None\"):\n field_value.append(None)\n else:\n field_value.append(getInnerText(k).strip())\n```\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [ ] I have added or updated relevant docs, including release notes if applicable.\n- [ ] I have attached screenshots in both light and dark modes for any UI changes.",
+ "author": "user_5b5558b13564",
+ "created_at": "2025-12-18T04:54:53+00:00",
+ "merged_at": "2025-12-22T19:21:01+00:00",
+ "base_branch": "main",
+ "head_branch": "ticket_36786",
+ "additions": 127,
+ "deletions": 9,
+ "changed_files": 3,
+ "files": [
+ {
+ "filename": "django/core/serializers/xml_serializer.py",
+ "status": "modified",
+ "additions": 33,
+ "deletions": 9,
+ "changes": 42,
+ "patch": "@@ -134,7 +134,10 @@ def handle_fk_field(self, obj, field):\n # Iterable natural keys are rolled out as subelements\n for key_value in natural_key_value:\n self.xml.startElement(\"natural\", {})\n- self.xml.characters(str(key_value))\n+ if key_value is None:\n+ self.xml.addQuickElement(\"None\")\n+ else:\n+ self.xml.characters(str(key_value))\n self.xml.endElement(\"natural\")\n else:\n self.xml.characters(str(related_att))\n@@ -160,7 +163,10 @@ def handle_m2m(value):\n self.xml.startElement(\"object\", {})\n for key_value in natural:\n self.xml.startElement(\"natural\", {})\n- self.xml.characters(str(key_value))\n+ if key_value is None:\n+ self.xml.addQuickElement(\"None\")\n+ else:\n+ self.xml.characters(str(key_value))\n self.xml.endElement(\"natural\")\n self.xml.endElement(\"object\")\n else:\n@@ -279,7 +285,11 @@ def _handle_object(self, node):\n if value == base.DEFER_FIELD:\n deferred_fields[field] = [\n [\n- getInnerText(nat_node).strip()\n+ (\n+ None\n+ if nat_node.getElementsByTagName(\"None\")\n+ else getInnerText(nat_node).strip()\n+ )\n for nat_node in obj_node.getElementsByTagName(\"natural\")\n ]\n for obj_node in field_node.getElementsByTagName(\"object\")\n@@ -292,7 +302,11 @@ def _handle_object(self, node):\n value = self._handle_fk_field_node(field_node, field)\n if value == base.DEFER_FIELD:\n deferred_fields[field] = [\n- getInnerText(k).strip()\n+ (\n+ None\n+ if k.getElementsByTagName(\"None\")\n+ else getInnerText(k).strip()\n+ )\n for k in field_node.getElementsByTagName(\"natural\")\n ]\n else:\n@@ -317,16 +331,21 @@ def _handle_fk_field_node(self, node, field):\n Handle a node for a ForeignKey\n \"\"\"\n # Check if there is a child node named 'None', returning None if so.\n- if node.getElementsByTagName(\"None\"):\n+ natural_keys = node.getElementsByTagName(\"natural\")\n+ if node.getElementsByTagName(\"None\") and not natural_keys:\n return None\n else:\n model = field.remote_field.model\n if hasattr(model._default_manager, \"get_by_natural_key\"):\n- keys = node.getElementsByTagName(\"natural\")\n- if keys:\n+ if natural_keys:\n # If there are 'natural' subelements, it must be a natural\n # key\n- field_value = [getInnerText(k).strip() for k in keys]\n+ field_value = []\n+ for k in natural_keys:\n+ if k.getElementsByTagName(\"None\"):\n+ field_value.append(None)\n+ else:\n+ field_value.append(getInnerText(k).strip())\n try:\n obj = model._default_manager.db_manager(\n self.db\n@@ -367,7 +386,12 @@ def m2m_convert(n):\n if keys:\n # If there are 'natural' subelements, it must be a natural\n # key\n- field_value = [getInnerText(k).strip() for k in keys]\n+ field_value = []\n+ for k in keys:\n+ if k.getElementsByTagName(\"None\"):\n+ field_value.append(None)\n+ else:\n+ field_value.append(getInnerText(k).strip())\n obj_pk = (\n default_manager.db_manager(self.db)\n .get_by_natural_key(*field_value)"
+ },
+ {
+ "filename": "tests/serializers/models/natural.py",
+ "status": "modified",
+ "additions": 28,
+ "deletions": 0,
+ "changes": 28,
+ "patch": "@@ -91,3 +91,31 @@ class PostToOptOutSubclassUser(models.Model):\n subscribers = models.ManyToManyField(\n SubclassNaturalKeyOptOutUser, related_name=\"subscribed_posts\", blank=True\n )\n+\n+\n+class NaturalKeyWithNullableFieldManager(models.Manager):\n+ def get_by_natural_key(self, name, optional_id):\n+ return self.get(name=name, optional_id=optional_id)\n+\n+\n+class NaturalKeyWithNullableField(models.Model):\n+ name = models.CharField(max_length=100)\n+ optional_id = models.CharField(max_length=100, null=True, blank=True)\n+\n+ objects = NaturalKeyWithNullableFieldManager()\n+\n+ class Meta:\n+ unique_together = [[\"name\", \"optional_id\"]]\n+\n+ def natural_key(self):\n+ return (self.name, self.optional_id)\n+\n+\n+class FKToNaturalKeyWithNullable(models.Model):\n+ ref = models.ForeignKey(\n+ NaturalKeyWithNullableField, on_delete=models.CASCADE, null=True\n+ )\n+ refs = models.ManyToManyField(\n+ NaturalKeyWithNullableField, related_name=\"m2m_referrers\"\n+ )\n+ data = models.CharField(max_length=100, default=\"\")"
+ },
+ {
+ "filename": "tests/serializers/test_natural.py",
+ "status": "modified",
+ "additions": 66,
+ "deletions": 0,
+ "changes": 66,
+ "patch": "@@ -6,8 +6,10 @@\n Child,\n FKAsPKNoNaturalKey,\n FKDataNaturalKey,\n+ FKToNaturalKeyWithNullable,\n NaturalKeyAnchor,\n NaturalKeyThing,\n+ NaturalKeyWithNullableField,\n NaturalPKWithDefault,\n PostToOptOutSubclassUser,\n SubclassNaturalKeyOptOutUser,\n@@ -280,6 +282,60 @@ def natural_key_opt_out_test(self, format):\n )\n \n \n+def nullable_natural_key_fk_test(self, format):\n+ target_with_none = NaturalKeyWithNullableField.objects.create(\n+ name=\"test_none\",\n+ optional_id=None,\n+ )\n+ target_with_value = NaturalKeyWithNullableField.objects.create(\n+ name=\"test_value\",\n+ optional_id=\"some_id\",\n+ )\n+ fk_to_none = FKToNaturalKeyWithNullable.objects.create(\n+ ref=target_with_none,\n+ data=\"points_to_none\",\n+ )\n+ fk_to_value = FKToNaturalKeyWithNullable.objects.create(\n+ ref=target_with_value,\n+ data=\"points_to_value\",\n+ )\n+ objects = [target_with_none, target_with_value, fk_to_none, fk_to_value]\n+ serialized = serializers.serialize(\n+ format,\n+ objects,\n+ use_natural_foreign_keys=True,\n+ use_natural_primary_keys=True,\n+ )\n+ objs = list(serializers.deserialize(format, serialized))\n+ self.assertEqual(objs[2].object.ref_id, target_with_none.pk)\n+ self.assertEqual(objs[3].object.ref_id, target_with_value.pk)\n+\n+\n+def nullable_natural_key_m2m_test(self, format):\n+ target_with_none = NaturalKeyWithNullableField.objects.create(\n+ name=\"test_none\",\n+ optional_id=None,\n+ )\n+ target_with_value = NaturalKeyWithNullableField.objects.create(\n+ name=\"test_value\",\n+ optional_id=\"some_id\",\n+ )\n+ m2m_obj = FKToNaturalKeyWithNullable.objects.create(data=\"m2m_test\")\n+ m2m_obj.refs.set([target_with_none, target_with_value])\n+ objects = [target_with_none, target_with_value, m2m_obj]\n+ serialized = serializers.serialize(\n+ format,\n+ objects,\n+ use_natural_foreign_keys=True,\n+ use_natural_primary_keys=True,\n+ )\n+ objs = list(serializers.deserialize(format, serialized))\n+ self.assertCountEqual(\n+ objs[2].m2m_data[\"refs\"],\n+ [target_with_none.pk, target_with_value.pk],\n+ )\n+\n+\n # Dynamically register tests for each serializer\n register_tests(\n NaturalKeySerializerTests,\n@@ -319,3 +375,13 @@ def natural_key_opt_out_test(self, format):\n \"test_%s_natural_key_opt_out\",\n natural_key_opt_out_test,\n )\n+register_tests(\n+ NaturalKeySerializerTests,\n+ \"test_%s_nullable_natural_key_fk\",\n+ nullable_natural_key_fk_test,\n+)\n+register_tests(\n+ NaturalKeySerializerTests,\n+ \"test_%s_nullable_natural_key_m2m\",\n+ nullable_natural_key_m2m_test,\n+)"
+ }
+ ],
+ "reviews": [
+ {
+ "id": 3600013397,
+ "user": "user_3a67c55598c5",
+ "state": "COMMENTED",
+ "body": "Thanks -- especially appreciate the tests.\n\nMain feedback at this point is to just prioritize a smaller diff over what we might otherwise do if rewriting this from scratch.",
+ "submitted_at": "2025-12-19T21:02:40+00:00"
+ },
+ {
+ "id": 3600792919,
+ "user": "user_5b5558b13564",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T06:31:15+00:00"
+ },
+ {
+ "id": 3600793022,
+ "user": "user_5b5558b13564",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T06:31:34+00:00"
+ },
+ {
+ "id": 3600793063,
+ "user": "user_5b5558b13564",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T06:31:45+00:00"
+ },
+ {
+ "id": 3600793089,
+ "user": "user_5b5558b13564",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T06:31:51+00:00"
+ },
+ {
+ "id": 3600793112,
+ "user": "user_5b5558b13564",
+ "state": "COMMENTED",
+ "body": null,
+ "submitted_at": "2025-12-20T06:31:56+00:00"
+ },
+ {
+ "id": 3604450136,
+ "user": "user_3a67c55598c5",
+ "state": "APPROVED",
+ "body": "Thank you, looks great! 🎁",
+ "submitted_at": "2025-12-22T15:10:22+00:00"
+ }
+ ],
+ "review_comments": [
+ {
+ "id": 2636227028,
+ "user": "user_3a67c55598c5",
+ "body": "I'd rewrite this as a for loop.",
+ "path": "django/core/serializers/xml_serializer.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T20:31:49+00:00"
+ },
+ {
+ "id": 2636251555,
+ "user": "user_3a67c55598c5",
+ "body": "For the sake of having a much smaller diff, I would suggest leaving most of this where it was and just fix the condition. (e.g. lift up `keys = ...` and then check `... and not keys: return None`, perhaps improving the variable name `keys`).\n\nYour version has a terser if condition, but this code is touched so infrequently that I think we should prioritize a smaller diff and more understandable blames over more readable if conditions.",
+ "path": "django/core/serializers/xml_serializer.py",
+ "line": 323,
+ "side": "LEFT",
+ "created_at": "2025-12-19T20:41:23+00:00"
+ },
+ {
+ "id": 2636265959,
+ "user": "user_3a67c55598c5",
+ "body": "So my example of `UUIDField` on the ticket was just what I happened to be working with (and show a really nice validation problem when attempting the roundtrip). However, it's not very realistic as a member of a natural key (and doesn't work well with the yaml serializer). Could I ask you to try another field type?",
+ "path": "tests/serializers/models/natural.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T20:47:16+00:00"
+ },
+ {
+ "id": 2636273458,
+ "user": "user_3a67c55598c5",
+ "body": "Do we need the saving part, or can we just assert against the unsaved object and still capture the underlying issue?",
+ "path": "tests/serializers/test_natural.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T20:50:17+00:00"
+ },
+ {
+ "id": 2636274402,
+ "user": "user_3a67c55598c5",
+ "body": "You can remove these comments to blend in with the surrounding style.",
+ "path": "tests/serializers/test_natural.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T20:50:42+00:00"
+ },
+ {
+ "id": 2636293382,
+ "user": "user_3a67c55598c5",
+ "body": "Great models -- trying your tests against main shows all kinds of nasty failures 👍",
+ "path": "tests/serializers/models/natural.py",
+ "line": 114,
+ "side": "RIGHT",
+ "created_at": "2025-12-19T20:59:48+00:00"
+ },
+ {
+ "id": 2636857672,
+ "user": "user_5b5558b13564",
+ "body": "Agreed, rewritten as a for loop.",
+ "path": "django/core/serializers/xml_serializer.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-20T06:31:15+00:00"
+ },
+ {
+ "id": 2636857798,
+ "user": "user_5b5558b13564",
+ "body": "I tried to simplify the logic, but ended up making a bigger diff than needed. Your suggestion is the better approach.\nI've updated it.",
+ "path": "django/core/serializers/xml_serializer.py",
+ "line": 323,
+ "side": "LEFT",
+ "created_at": "2025-12-20T06:31:34+00:00"
+ },
+ {
+ "id": 2636857867,
+ "user": "user_5b5558b13564",
+ "body": "Agreed. Changed to `CharField` it's more generalizable across all serializers and aligns with other natural key fields in the test suite.\ne.g. (`NaturalKeyAnchor.data`, `NaturalKeyThing.key`).",
+ "path": "tests/serializers/models/natural.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-20T06:31:45+00:00"
+ },
+ {
+ "id": 2636857926,
+ "user": "user_5b5558b13564",
+ "body": "From a serialization perspective, the responsibility is data transformation `save()` is a separate concern. I'll simplify the test. Thanks!",
+ "path": "tests/serializers/test_natural.py",
+ "line": null,
+ "side": "RIGHT",
+ "created_at": "2025-12-20T06:31:51+00:00"
+ },
+ {
+ "id": 2636857996,
+ "user": "user_5b5558b13564",
+ "body": "Thanks!",
+ "path": "tests/serializers/models/natural.py",
+ "line": 114,
+ "side": "RIGHT",
+ "created_at": "2025-12-20T06:31:56+00:00"
+ }
+ ],
+ "meta": {
+ "languages": [
+ "py"
+ ],
+ "touches_tests": true,
+ "review_state_summary": {
+ "COMMENTED": 6,
+ "APPROVED": 1
+ },
+ "meaningful_comment_count": 10,
+ "has_approval": true,
+ "has_changes_requested": false,
+ "total_review_comments": 11
+ }
+}
+{
+ "_id": "13698cf55f33be35",
+ "_schema_version": "1.0",
+ "_cleaned_at": "2026-02-12T07:46:51.593428+00:00",
+ "repo": "django/django",
+ "repo_url": "https://github.com/django/django",
+ "license_name": "BSD 3-Clause \"New\" or \"Revised\" License",
+ "license_spdx": "BSD-3-Clause",
+ "pr_number": 20418,
+ "title": "Fixed #36807 -- Fixed form field alignment under in the admin.",
+ "body": "#### Trac ticket number\nticket-36807\n\n#### Branch description\nIt isn't safe to set `display: flex` on ``, because on Safari, this interferes with `display: block` on child divs.\n\n[NAME_REDACTED] for the report.\n\nRegression in 4187da258fe212d494cb578a0bc2b52c4979ab95.\n\n#### Checklist\n- [x] This PR targets the `main` branch. \n- [x] The commit message is written in past tense, mentions the ticket number, and ends with a period.\n- [x] I have checked the \"Has patch\" ticket flag in the Trac system.\n- [x] I have added or updated relevant tests.\n- [x] I have added or updated relevant docs, including release notes if applicable.\n- [x] I have attached screenshots in both light and dark modes for any UI changes.\n\n#### Before\n \n\n#### After (light)\n \n\n#### After (dark)\n ",
+ "author": "user_3a67c55598c5",
+ "created_at": "2025-12-17T14:45:14+00:00",
+ "merged_at": "2025-12-23T02:04:01+00:00",
+ "base_branch": "main",
+ "head_branch": "jtw/fieldset",
+ "additions": 12,
+ "deletions": 10,
+ "changed_files": 6,
+ "files": [
+ {
+ "filename": "django/contrib/admin/static/admin/css/forms.css",
+ "status": "modified",
+ "additions": 2,
+ "deletions": 6,
+ "changes": 8,
+ "patch": "@@ -102,7 +102,7 @@ fieldset .inline-heading,\n }\n \n .aligned legend {\n- float: left;\n+ float: inline-start;\n }\n \n .aligned legend,\n@@ -148,15 +148,11 @@ form .aligned ul {\n }\n \n form .aligned div.radiolist {\n- display: inline-block;\n+ display: block;\n margin: 0;\n padding: 0;\n }\n \n-form .aligned fieldset div.help {\n- margin-left: 0;\n-}\n-\n form .aligned p.help,\n form .aligned div.help {\n margin-top: 0;"
+ },
+ {
+ "filename": "django/contrib/admin/static/admin/css/responsive.css",
+ "status": "modified",
+ "additions": 4,
+ "deletions": 0,
+ "changes": 4,
+ "patch": "@@ -560,6 +560,10 @@ input[type=\"submit\"], button {\n margin-top: 5px;\n }\n \n+ form .aligned fieldset div.flex-container {\n+ display: unset;\n+ }\n+\n /* Related widget */\n \n .related-widget-wrapper {"
+ },
+ {
+ "filename": "django/contrib/admin/templates/admin/auth/user/change_password.html",
+ "status": "modified",
+ "additions": 1,
+ "deletions": 1,
+ "changes": 2,
+ "patch": "@@ -40,7 +40,7 @@\n \n