Article View: linux.debian.bugs.dist
Article #3509Bug#1153243: sphinx: please make the output of object_description reproducible when passed a types.MappingProxyType instance
From: Chris Lamb
Date: Fri, 06 Nov 2026 17:40
Date: Fri, 06 Nov 2026 17:40
87 lines
6204 bytes
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--
Technical Details
Message-ID:
<NWw4V-aeyG-13@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From: "Chris Lamb" <lamby@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153243: sphinx: please make the output of object_description reproducible when passed a types.MappingProxyType instance
Date: Fri, 06 Nov 2026 18:40:01 +0100
Message-ID: <NWw4V-aeyG-13@gated-at.bofh.it>
X-Original-To: submit@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Fri Nov 6 17:31:07 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: "Chris Lamb" <lamby@debian.org>, 1153243@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: reproducible-bugs@lists.alioth.debian.org, team+python@tracker.debian.org
X-Debian-Pr-Message: report 1153243
X-Debian-Pr-Package: src:sphinx
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: sphinx
X-Me-Sender: <xms:Ig7uaryoS3aIZXqO-QXtS8Kmg12llZc4-aqkl3VhFXkfUgVld_LO6w>
<xme:Ig7uauGTrsinEIo_SuWt05eGm2BhCci5zYMmfR8RoLz9WlX8CRbDU15D0aR5BHbrl
OrIQ9LTxvX5HtXJ-m-zxdLxvPMP5yvdLA9p0eZI3BqB_ulDaw>
X-Me-Proxy-Cause: dmFkZTG1SDTsMFQOLpuF3N/EXTqECHzfLyCFRyYv7PeOWDoRoJC6Vrduq7b+1tJc4rEOf2
8VYQq4+7Uah+JIZka6QNOw4Ckyo+cY8ephmCGTpf8zgG9klc2K1vHIykmuQLIeuCcwAcgY
Q/nKCcaWdu5pQANWMOZR7rNdePnQNJzmGJy3SUZ+l84xxkLKynY8+tFInNRaPzG2iGevOy
MOatmDt5e5zB1L5OxF/Fc1LkKMdykMM3ZSdrwZsJvyUvU7yfgeYjjS9UCaz6nJmhgy7m0J
i7K9urAJ6g9lwEs2T29wyd+6JHOkfTLmmnQ8D1mBW3DsJ9+lBmpzQYJlui+uEPPOO1zBDq
GIvTLd23ymk6+nbO+i+354RR7vbsmP7LruXCi3GIVHXs7hKjFZMFY+hLgVNiZXmGgyuOZw
J1rXropyRdCezI/3lqaYCgJWDt8Hd+UBiddfgrT5b/dxo9OA8J/3Z11Qc+PHUFaHzRQMIA
S6/hZbF5rAdEpW0rOXGw/SG87oza2WHmvdQ2ScznoQOS06na0kEPD/rpDCwsfkCxsR8Ktu
N/xOLG1uRjTwZehJs4Xdqjd1EcvXKYdopystjNdZ+nEf30D2JADk/CPuQBFjHorV4VO+cN
BN+yeP4E4TQAnw939UX+4q4V2YXWN5mhRL2NPzJmMOCAeJggDZH1Ygg7QOyg
X-Me-Proxy: <xmx:Ig7uanC1h93jNQrhjViUSzp6pjZoG9-vz64N7xXur4W6mMBpMtQ4lQ>
<xmx:Ig7uatdhgAt08H3g0ipR1D7fCdVCNWMeGHfSHgBbp6XVw0oCiHwwIw>
<xmx:Ig7uavfH6YJInvC0U2ffRP8fkf36ouXqouC-NVIStT2_JVZLZ8Am9g>
<xmx:Ig7uahj7kBIhf0XWrlR04BDF4pAOrHthnfgoFUwjV3FkcMkiGnI7Yg>
<xmx:Ig7uarSCcYJAxkMvXRMXf2g9hGyofriSJJECw50a-X4dtVSwyUHkoER8>
Feedback-ID: i61d64b6b:Fastmail
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary=7a822d069576f6f52f238c481c67d681dae96b5b
X-Debian-User: lamby
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001086
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 87
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Fri, 06 Nov 2026 09:27:41 -0800
X-Original-Message-ID: <179398547327.728618.9593070345397747895@bigcat>