Debian Codegraph @

debian/patches/Bug-1983736-Patch-jsonschema-to-work-with-Python-3.14-r-m.patch

raw
1 From: Jan-Erik Rediger <[email protected]>
2 Date: Wed, 27 Aug 2025 01:09:58 +0000
3 Subject: Bug 1983736 - Patch jsonschema to work with Python 3.14+
4 r=mach-reviewers,ahal,ahochheiden
5
6 Differential Revision: https://phabricator.services.mozilla.com/D262335
7
8 (cherry picked from commit b09b27487e5d649612e0baae309608954ff9d542)
9
10 Origin: upstream, 144.0
11 ---
12 python/mozbuild/mozbuild/vendor/vendor_python.py | 4 ++++
13 third_party/python/jsonschema/jsonschema/validators.py | 5 ++++-
14 2 files changed, 8 insertions(+), 1 deletion(-)
15
16 diff --git a/python/mozbuild/mozbuild/vendor/vendor_python.py b/python/mozbuild/mozbuild/vendor/vendor_python.py
17 index 9acee94..2801e1b 100644
18 --- a/python/mozbuild/mozbuild/vendor/vendor_python.py
19 +++ b/python/mozbuild/mozbuild/vendor/vendor_python.py
20 @@ -40,6 +40,10 @@ EXCLUDED_PACKAGES = {
21 # modified 'dummy' version of it so that the dependency checks still succeed, but
22 # if it ever is attempted to be used, it will fail gracefully.
23 "ansicon",
24 + # jsonschema 4.17.3 is incompatible with Python 3.14+,
25 + # but later versions use a dependency with Rust components, which we thus can't vendor.
26 + # For now we apply the minimal patch to jsonschema to make it work again.
27 + "jsonschema",
28 }
29
30
31 diff --git a/third_party/python/jsonschema/jsonschema/validators.py b/third_party/python/jsonschema/jsonschema/validators.py
32 index 66e803e..88316a8 100644
33 --- a/third_party/python/jsonschema/jsonschema/validators.py
34 +++ b/third_party/python/jsonschema/jsonschema/validators.py
35 @@ -875,8 +875,11 @@ class RefResolver:
36 return None
37 uri, fragment = urldefrag(url)
38 for subschema in subschemas:
39 + id = subschema["$id"]
40 + if not isinstance(id, str):
41 + continue
42 target_uri = self._urljoin_cache(
43 - self.resolution_scope, subschema["$id"],
44 + self.resolution_scope, id,
45 )
46 if target_uri.rstrip("/") == uri.rstrip("/"):
47 if fragment: