Whilst working on the Reproducible Builds effort [0], we noticed
that sphinx could generate output that is not reproducible.
In particular, the rendering of `frozenset` objects in default
arguments and elsewhere is currently non-determinstic.
For example:
frozenset(['a', 'b', 'c'])
Might be rendered as any of:
frozenset({'a', 'b', 'c'})
frozenset({'a', 'c', 'b'})
frozenset({'b', 'a', 'c'})
frozenset({'b', 'c', 'a'})
frozenset({'c', 'a', 'b'})
frozenset({'c', 'b', 'a'})
Patch attached that sorts the contents of frozensets whilst rendering.
This is parallel to the `dict` and `set` type logic
[0] https://reproducible-builds.org/
Whilst working on the Reproducible Builds effort [0], we noticed
that sphinx could generate output that is not reproducible.
In particular, the rendering of `set` objects in default arguments
and elsewhere is currently non-determinstic. For example:
class A_Class(object):
a_set = {'a', 'b', 'c'}
Might be rendered as any of:
{'a', 'b', 'c'}
{'a', 'c', 'b'}
{'b', 'a', 'c'}
{'b', 'c', 'a'}
{'c', 'a', 'b'}
{'c', 'b', 'a'}
Patch attached that sorts the contents of sets whilst rendering.
This is parallel to the `dict` key sorting.
This was originally filed in Debian as #895553 [1].
[0] https://reproducible-builds.org/
[1] https://bugs.debian.org/895553
Signed-off-by: Chris Lamb <lamby@debian.org>
This improves handling of wrapped functions and bound methods.
It turns out that we no longer need to hack in support for
functools.partial; inspect.signature handles this automatically. Added
a test to make sure this didn't/doesn't regress.
The fallback implemented in #2731 cannot return `obj.__dict__[name]`
if the `__dict__` method has been redefined in such a way that it
raises an exception when trying to access it.
This commit adds a try-except block to work around this.