Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lamb <lamby@debian.org>2021-10-21 12:41:41 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-10-22 20:18:01 +0300
commitff533f59bbba97f50e71b23c2d3f8e45a8c4fc7c (patch)
treea6e86b29c6ac190b499f32ea2533196b1733b4ba /sphinx/util
parent6472fb92244f2c8384e0a1b299109398e0e10a52 (diff)
Make util.typing.restify sanitise unreproducible output (eg. memory addresses)
Whilst working on the Reproducible Builds effort [0] I noticed that sphinx generates output that is not reproducible, causing a number of packages in Debian to unreproducible. Specifically, when Sphinx locates an alias of an instance when generating 'autodoc' documentation, it uses the raw Python repr(...) of the object and does not sanitise it for memory addresses (etc.) like elsewhere in Sphinx. This can result in documentation like this: -<dd><p>alias of &lt;webob.client.SendRequest object at 0x7fd769189df0&gt;</p> +<dd><p>alias of &lt;webob.client.SendRequest object at 0x7f0f02233df0&gt;</p> Patch attached that uses the object_description method, which was added to fix precisely this kind of issue. I originally filed this in Debian as bug #996948 [1]. [0] https://reproducible-builds.org/ [1] https://bugs.debian.org/996948
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/typing.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py
index 87707d48f..a2ab5f931 100644
--- a/sphinx/util/typing.py
+++ b/sphinx/util/typing.py
@@ -144,7 +144,7 @@ def restify(cls: Optional[Type]) -> str:
else:
return _restify_py36(cls)
except (AttributeError, TypeError):
- return repr(cls)
+ return inspect.object_description(cls)
def _restify_py37(cls: Optional[Type]) -> str: