summaryrefslogtreecommitdiffstats
path: root/debian/patches/python_3.12.4.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/python_3.12.4.diff')
-rw-r--r--debian/patches/python_3.12.4.diff33
1 files changed, 33 insertions, 0 deletions
diff --git a/debian/patches/python_3.12.4.diff b/debian/patches/python_3.12.4.diff
new file mode 100644
index 0000000..9e7d09a
--- /dev/null
+++ b/debian/patches/python_3.12.4.diff
@@ -0,0 +1,33 @@
+From: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
+Date: Tue, 23 Apr 2024 20:25:34 +0200
+Subject: Fix `sphinx.util.inspect_evaluate_forwardref` for Python 3.12.4
+ (#12317)
+
+Python has recently [1] changed the signature of `_evaluate` for forward references
+because of type parameters. The change affects 3.13, and was backported to 3.12.4.
+
+[1]: https://github.com/python/cpython/pull/118104
+
+(cherry picked from commit b5f3ef987ab5c2147d651ad84cc7d72c84ac6acc)
+---
+ sphinx/util/inspect.py | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
+index 6b13b29..dfb4e40 100644
+--- a/sphinx/util/inspect.py
++++ b/sphinx/util/inspect.py
+@@ -681,6 +681,13 @@ def _evaluate_forwardref(
+ localns: dict[str, Any] | None,
+ ) -> Any:
+ """Evaluate a forward reference."""
++ if sys.version_info >= (3, 12, 4):
++ # ``type_params`` were added in 3.13 and the signature of _evaluate()
++ # is not backward-compatible (it was backported to 3.12.4, so anything
++ # before 3.12.4 still has the old signature).
++ #
++ # See: https://github.com/python/cpython/pull/118104.
++ return ref._evaluate(globalns, localns, {}, recursive_guard=frozenset()) # type: ignore[arg-type, misc]
+ return ref._evaluate(globalns, localns, frozenset())
+
+