🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by Chris Lamb Fri, 06 Nov 2026 17:40
Bug#1153243: sphinx: please make the output of object_description reproducible when passed a types.MappingProxyType instance
#3509
Author: Chris Lamb
Date: Fri, 06 Nov 2026 17:40
87 lines
6204 bytes
--7a822d069576f6f52f238c481c67d681dae96b5b
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Source: sphinx
Version: 9.2.0-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
sphinx was generating nondetermistic output.

Specifically, although Sphinx has code to generate determinstic string
representations of many Python objects (via the object_description metho=
d),
it does not (yet) know to traverse types.MappingProxyType instances.

The existing code will run repr(=E2=80=A6) on these dict-like objects an=
d this
will usually result in deterministic output. But the keys of these of
dictionaries are not sorted (AFAICT), and, more importantly, the values
of MappingProxyType's underlying dict are not recursively passed to
object_description.

That means that if a MappingProxyType dict contains, say, a frozenset
instance, then it will not be 'sorted' by object_description, and thus
Sphinx will generate output nondetermistically when facing this kind of
instance.

   >>> types.MappingProxyType({"key": frozenset(("a", "b"))})

You can see this in the python-keystoneauth1 package:

  https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/pyt=
hon-keystoneauth1.html

This diff is non-intuitive to read, but you have:

   __dict__ =3D mappingproxy(
      {
       '__abstractmethods__': frozenset({'from_token', 'is_interface_mat=
ch'}),
       '__annotate_func__': None,

     [etc]

... where the frozenset assigned to __abstractmethods__ is the one not b=
eing sorted
as it is never seen by object_description.

Patch attached.

  [0] https://reproducible-builds.org/


Regards,

--=20
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-

--7a822d069576f6f52f238c481c67d681dae96b5b
Content-Disposition: attachment; filename="sphinx.diff.txt"
Content-Type: text/plain; charset=us-ascii; name="sphinx.diff.txt"
Content-Transfer-Encoding: base64

ZGlmZiAtLWdpdCBzcGhpbngvdXRpbC9pbnNwZWN0LnB5IHNwaGlueC91dGlsL2luc3BlY3Qu
cHkKaW5kZXggMTQwZDk1OS4uMzYzNjM0MSAxMDA2NDQKLS0tIHNwaGlueC91dGlsL2luc3Bl
Y3QucHkKKysrIHNwaGlueC91dGlsL2luc3BlY3QucHkKQEAgLTU0MCw2ICs1NDAsMTEgQEAg
ZGVmIG9iamVjdF9kZXNjcmlwdGlvbihvYmo6IEFueSwgKiwgX3NlZW46IGZyb3plbnNldFtp
bnRdID0gZnJvemVuc2V0KCkpIC0+IHN0cjoKICAgICAgICAgICAgIHJldHVybiAnbGlzdCgu
Li4pJwogICAgICAgICBzZWVuIHw9IHtpZChvYmopfQogICAgICAgICByZXR1cm4gJ1slc10n
ICUgJywgJy5qb2luKG9iamVjdF9kZXNjcmlwdGlvbih4LCBfc2Vlbj1zZWVuKSBmb3IgeCBp
biBvYmopCisgICAgZWxpZiBpc2luc3RhbmNlKG9iaiwgdHlwZXMuTWFwcGluZ1Byb3h5VHlw
ZSk6CisgICAgICAgIGlmIGlkKG9iaikgaW4gc2VlbjoKKyAgICAgICAgICAgIHJldHVybiAn
bWFwcGluZ3Byb3h5KC4uLiknCisgICAgICAgIHNlZW4gfD0ge2lkKG9iail9CisgICAgICAg
IHJldHVybiAnbWFwcGluZ3Byb3h5KCVzKScgJSBvYmplY3RfZGVzY3JpcHRpb24oZGljdChv
YmopKQogCiAgICAgdHJ5OgogICAgICAgICBzID0gcmVwcihvYmopCg==

--7a822d069576f6f52f238c481c67d681dae96b5b--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads