Skip to content

Commit ef7dfcd

Browse files
committed
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
1 parent 1f77be7 commit ef7dfcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sphinx/util/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def restify(cls: Optional[Type]) -> str:
144144
else:
145145
return _restify_py36(cls)
146146
except (AttributeError, TypeError):
147-
return repr(cls)
147+
return inspect.object_description(cls)
148148

149149

150150
def _restify_py37(cls: Optional[Type]) -> str:

0 commit comments

Comments
 (0)