[Python-modules-team] Bug#833820: sphinx: Avoid evaulating default function arguments when including them in the documentation

Dmitry Shachnev mitya57 at debian.org
Thu Aug 11 18:46:02 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20160811/5bc6d28d/attachment.sig>


More information about the Python-modules-team mailing list