[Python-modules-team] Bug#833820: sphinx: Avoid evaulating default function arguments when including them in the documentation
[Dmitry Shachnev] > Speaking about your example, I would recommend against using such > functions at all: the default argument of that function is module > *import* time, not the actual time when it is executed; this is not > what one may expect. I agree completely, and that issue is being tracked as http://bugs.debian.org/833821 > and is going to be fixed upstream. -- Happy hacking Petter Reinholdtsen ___ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team
[Python-modules-team] Bug#833820: sphinx: Avoid evaulating default function arguments when including them in the documentation
Control: forwarded -1 https://github.com/sphinx-doc/sphinx/issues/2844 Hi Petter, On Tue, Aug 09, 2016 at 01:08:23AM +0200, Petter Reinholdtsen wrote: > Hi. The documentation generated by sphinx expands default python > arguments instead of reproducing the values listed in the source. Thanks for the bug report. Indeed such behavior is not only breaking the reproducible builds, but also a bit misleading. However I think this may be non-trivial to fix, as Sphinx tries to import the module, rather than parse it, and Python evaluates the arguments during module import. The same result (evaluated argument) can be seen if you call the built-in help() against that function. Speaking about your example, I would recommend against using such functions at all: the default argument of that function is module *import* time, not the actual time when it is executed; this is not what one may expect. In any case, I have forwarded this bug to upstream developers, let's see what they think about it. -- Dmitry Shachnev signature.asc Description: PGP signature ___ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team
[Python-modules-team] Bug#833820: sphinx: Avoid evaulating default function arguments when including them in the documentation
Source: sphinx Version: 1.3.6-2 Severity: wishlist User: reproducible-bui...@lists.alioth.debian.org Usertags: toolchain X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org Hi. The documentation generated by sphinx expands default python arguments instead of reproducing the values listed in the source. This is related to the reproducability issues reported in https://bugs.debian.org/795976 > and https://bugs.debian.org/822197 >, but seem to be a different issue from those solved there. I discovered this from https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/txtorcon.html > which report this difference in the generated documentation (txtorcon-state.txt): @@ -385,15 +385,15 @@ Returns: Deferred which callbacks with this Circuit instance ONLY after Tor has confirmed it is gone (not simply that the CLOSECIRCUIT command has been queued). This could be a while if you included IfUnused. - age(now=datetime.datetime(2016, 8, 5, 7, 33, 8, 845335)) + age(now=datetime.datetime(2017, 9, 7, 13, 58, 10, 541674)) Returns an integer which is the difference in seconds from 'now' to when this circuit was created. Returns None if there is no created-time. update(args) This documentation is generated from this function definition in txtorcon/circuit.py in the source: def age(self, now=datetime.datetime.utcnow()): """ Returns an integer which is the difference in seconds from 'now' to when this circuit was created. Returns None if there is no created-time. """ Notice how the now argument is supposed to be a dynamic function call to datetime.datetime.utcnow(), and not a fixed timestamp as the documentation could lead you to believe. Please change sphinx to correctly report the arguments used by this age function. It would have the side effect of making the txtorcon build reproducable. -- Happy hacking Petter Reinholdtsen ___ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team