From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 525C4159C9C for ; Thu, 8 Aug 2024 15:22:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E80FAE2AD2; Thu, 8 Aug 2024 15:22:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9699E2AD2 for ; Thu, 8 Aug 2024 15:22:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B6A8234308B for ; Thu, 8 Aug 2024 15:22:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 934D01EBD for ; Thu, 8 Aug 2024 15:22:12 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1723130529.37709f02f65d2e6161240866b180b953a455b3a6.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/aiohttp/, dev-python/aiohttp/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/aiohttp/aiohttp-3.10.1-r1.ebuild dev-python/aiohttp/aiohttp-3.10.1.ebuild dev-python/aiohttp/files/aiohttp-3.10.1-py313.patch X-VCS-Directories: dev-python/aiohttp/ dev-python/aiohttp/files/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 37709f02f65d2e6161240866b180b953a455b3a6 X-VCS-Branch: master Date: Thu, 8 Aug 2024 15:22:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bcbec4e6-eba9-46ba-bd08-8a2285cf8654 X-Archives-Hash: 3b12e137ca0042bf2862df851e2f5484 commit: 37709f02f65d2e6161240866b180b953a455b3a6 Author: Michał Górny gentoo org> AuthorDate: Thu Aug 8 15:21:37 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Aug 8 15:22:09 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37709f02 dev-python/aiohttp: Backport py3.13 fixes Signed-off-by: Michał Górny gentoo.org> ...http-3.10.1.ebuild => aiohttp-3.10.1-r1.ebuild} | 20 ++--- .../aiohttp/files/aiohttp-3.10.1-py313.patch | 97 ++++++++++++++++++++++ 2 files changed, 106 insertions(+), 11 deletions(-) diff --git a/dev-python/aiohttp/aiohttp-3.10.1.ebuild b/dev-python/aiohttp/aiohttp-3.10.1-r1.ebuild similarity index 87% rename from dev-python/aiohttp/aiohttp-3.10.1.ebuild rename to dev-python/aiohttp/aiohttp-3.10.1-r1.ebuild index bcb2187e0df5..3a7db9402219 100644 --- a/dev-python/aiohttp/aiohttp-3.10.1.ebuild +++ b/dev-python/aiohttp/aiohttp-3.10.1-r1.ebuild @@ -40,6 +40,7 @@ BDEPEND=" dev-python/freezegun[${PYTHON_USEDEP}] www-servers/gunicorn[${PYTHON_USEDEP}] dev-python/pytest-mock[${PYTHON_USEDEP}] + dev-python/pytest-rerunfailures[${PYTHON_USEDEP}] dev-python/pytest-xdist[${PYTHON_USEDEP}] dev-python/re-assert[${PYTHON_USEDEP}] $(python_gen_cond_dep ' @@ -57,6 +58,12 @@ EPYTEST_XDIST=1 distutils_enable_tests pytest src_prepare() { + local PATCHES=( + # https://github.com/aio-libs/aiohttp/pull/8623 + # https://github.com/aio-libs/aiohttp/pull/8648 + "${FILESDIR}/${P}-py313.patch" + ) + # increase the timeout a little sed -e '/abs=/s/0.001/0.01/' -i tests/test_helpers.py || die # xfail_strict fails on py3.10 @@ -101,20 +108,11 @@ python_test() { # sigh local -x AIOHTTP_NO_EXTENSIONS=1 ;; - python3.13) - EPYTEST_DESELECT+=( - # buggy test - # https://github.com/aio-libs/aiohttp/issues/8551 - tests/test_web_urldispatcher.py::test_access_mock_special_resource - # new test (so not a regression) - # https://github.com/aio-libs/aiohttp/issues/8565 - tests/test_web_urldispatcher.py::test_access_symlink_loop - ) - ;; esac local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 local -x PYTEST_PLUGINS=pytest_mock,xdist.plugin rm -rf aiohttp || die - epytest -m "not internal and not dev_mode" + epytest -m "not internal and not dev_mode" \ + -p rerunfailures --reruns=5 } diff --git a/dev-python/aiohttp/files/aiohttp-3.10.1-py313.patch b/dev-python/aiohttp/files/aiohttp-3.10.1-py313.patch new file mode 100644 index 000000000000..03299a43a3c5 --- /dev/null +++ b/dev-python/aiohttp/files/aiohttp-3.10.1-py313.patch @@ -0,0 +1,97 @@ +From 02961d854c8f4277219699cd66970d1e90b371d4 Mon Sep 17 00:00:00 2001 +From: Steve Repsher +Date: Wed, 7 Aug 2024 07:51:50 -0400 +Subject: [PATCH] Fix monkey patches for pathlib changes in Python 3.13 (#8619) + +(cherry picked from commit d1c8dfbb11ea9989446e295fcee350255d5461c0) +--- + CHANGES/8551.contrib.rst | 1 + + tests/test_web_urldispatcher.py | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + create mode 100644 CHANGES/8551.contrib.rst + +diff --git a/tests/test_web_urldispatcher.py b/tests/test_web_urldispatcher.py +index a799f4ba146..de44ea0648c 100644 +--- a/tests/test_web_urldispatcher.py ++++ b/tests/test_web_urldispatcher.py +@@ -434,10 +434,10 @@ def mock_iterdir(self: pathlib.Path) -> Generator[pathlib.Path, None, None]: + raise PermissionError() + return real_iterdir(self) + +- def mock_is_dir(self: pathlib.Path) -> bool: ++ def mock_is_dir(self: pathlib.Path, **kwargs: Any) -> bool: + if my_dir.samefile(self.parent): + raise PermissionError() +- return real_is_dir(self) ++ return real_is_dir(self, **kwargs) + + monkeypatch.setattr("pathlib.Path.iterdir", mock_iterdir) + monkeypatch.setattr("pathlib.Path.is_dir", mock_is_dir) +@@ -554,8 +554,8 @@ async def test_access_mock_special_resource( + real_result = my_special.stat() + real_stat = pathlib.Path.stat + +- def mock_stat(self: pathlib.Path) -> os.stat_result: +- s = real_stat(self) ++ def mock_stat(self: pathlib.Path, **kwargs: Any) -> os.stat_result: ++ s = real_stat(self, **kwargs) + if os.path.samestat(s, real_result): + mock_mode = S_IFIFO | S_IMODE(s.st_mode) + s = os.stat_result([mock_mode] + list(s)[1:]) +From 75ff8e12d0c95af9347bb16de785d028930f7228 Mon Sep 17 00:00:00 2001 +From: Steve Repsher +Date: Thu, 8 Aug 2024 10:55:35 -0400 +Subject: [PATCH] Fix response to circular symlinks with Python v3.13 (#8642) + +Co-authored-by: J. Nick Koston +(cherry picked from commit e494277110e40fb5c1cc65a1558dfea7d8ae7ca8) +--- + CHANGES/8565.bugfix.rst | 1 + + aiohttp/web_fileresponse.py | 4 +++- + aiohttp/web_urldispatcher.py | 9 +++++---- + 3 files changed, 9 insertions(+), 5 deletions(-) + create mode 100644 CHANGES/8565.bugfix.rst + +diff --git a/aiohttp/web_fileresponse.py b/aiohttp/web_fileresponse.py +index 7fc5b3d787f..d8bbbe08993 100644 +--- a/aiohttp/web_fileresponse.py ++++ b/aiohttp/web_fileresponse.py +@@ -191,7 +191,9 @@ async def prepare(self, request: "BaseRequest") -> Optional[AbstractStreamWriter + file_path, st, file_encoding = await loop.run_in_executor( + None, self._get_file_path_stat_encoding, accept_encoding + ) +- except FileNotFoundError: ++ except OSError: ++ # Most likely to be FileNotFoundError or OSError for circular ++ # symlinks in python >= 3.13, so respond with 404. + self.set_status(HTTPNotFound.status_code) + return await super().prepare(request) + +diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py +index 688946626fd..558fb7d0c9b 100644 +--- a/aiohttp/web_urldispatcher.py ++++ b/aiohttp/web_urldispatcher.py +@@ -80,9 +80,9 @@ + BaseDict = dict + + CIRCULAR_SYMLINK_ERROR = ( +- OSError ++ (OSError,) + if sys.version_info < (3, 10) and sys.platform.startswith("win32") +- else RuntimeError ++ else (RuntimeError,) if sys.version_info < (3, 13) else () + ) + + YARL_VERSION: Final[Tuple[int, ...]] = tuple(map(int, yarl_version.split(".")[:2])) +@@ -694,8 +694,9 @@ def _resolve_path_to_response(self, unresolved_path: Path) -> StreamResponse: + else: + file_path = unresolved_path.resolve() + file_path.relative_to(self._directory) +- except (ValueError, CIRCULAR_SYMLINK_ERROR) as error: +- # ValueError for relative check; RuntimeError for circular symlink. ++ except (ValueError, *CIRCULAR_SYMLINK_ERROR) as error: ++ # ValueError is raised for the relative check. Circular symlinks ++ # raise here on resolving for python < 3.13. + raise HTTPNotFound() from error + + # if path is a directory, return the contents if permitted. Note the