File: py314-urljoin-trailing-hash.patch

package info (click to toggle)
twisted 25.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 20,560 kB
  • sloc: python: 203,171; makefile: 200; sh: 92; javascript: 36; xml: 31
file content (29 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Adi Roiban <adiroiban@gmail.com>
Date: Tue, 30 Sep 2025 19:04:07 +0100
Subject: Strip trailing hash for Python 3.14

Origin: backport, https://github.com/twisted/twisted/pull/12511
Bug: https://github.com/twisted/twisted/issues/12427
Bug: https://github.com/twisted/twisted/issues/12510
Bug-Debian: https://bugs.debian.org/1122044
Last-Update: 2025-12-07
---
 src/twisted/web/client.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/twisted/web/client.py b/src/twisted/web/client.py
index d3cd11f..4484db7 100644
--- a/src/twisted/web/client.py
+++ b/src/twisted/web/client.py
@@ -220,7 +220,10 @@ def _urljoin(base, url):
     """
     base, baseFrag = urldefrag(base)
     url, urlFrag = urldefrag(urljoin(base, url))
-    return urljoin(url, b"#" + (urlFrag or baseFrag))
+    # We strip the hash to get test pass on Python 3.14
+    # Looks like a regression in 3.14
+    # See https://github.com/twisted/twisted/issues/12427
+    return urljoin(url, b"#" + (urlFrag or baseFrag)).strip(b"#")
 
 
 def _makeGetterFactory(url, factoryFactory, contextFactory=None, *args, **kwargs):