From 2b9e63e55d19a5fe56e17fba5d48ec8f7ddc04dd Mon Sep 17 00:00:00 2001 From: Adrian Chaves Date: Fri, 31 Jul 2026 20:04:20 +0200 Subject: [PATCH] Give PyPy some leeway --- tests/test_utils_response.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_utils_response.py b/tests/test_utils_response.py index 608b2bbd9..72de08430 100644 --- a/tests/test_utils_response.py +++ b/tests/test_utils_response.py @@ -16,6 +16,11 @@ from scrapy.utils.response import ( response_status_message, ) +# Catastrophic backtracking makes the checks below take orders of magnitude +# longer than this, so the budget can be generous enough for slow interpreters +# like PyPy. +MAX_CPU_TIME = 0.2 + def _read_browser_output(burl: str) -> bytes: path = urlparse(burl).path @@ -185,8 +190,6 @@ def test_inject_base_url(body: bytes) -> None: def test_open_in_browser_redos_comment(): - MAX_CPU_TIME = 0.02 - # Exploit input from # https://makenowjust-labs.github.io/recheck/playground/ # for // (old pattern to remove comments). @@ -199,8 +202,6 @@ def test_open_in_browser_redos_comment(): def test_open_in_browser_redos_head(): - MAX_CPU_TIME = 0.02 - # Exploit input from # https://makenowjust-labs.github.io/recheck/playground/ # for /(|\s.*?>))/ (old pattern to find the head element).