Hi,

recent changes in Py3.4 affect the functionality of the two directives
"embedsignature" and "autotestdict".

The so-called "argument clinic" extracts any embedded signatures from
docstrings and moves them into a new property "__text_signature__". This is
done at runtime, i.e. when either "__doc__" or "__text_signature__" are
requested.

http://hg.python.org/cpython/file/6a3e09cd96f3/Objects/methodobject.c#l182

I personally consider this a feature (and it works nicely with the
signatures that Cython embeds), but you may or may not agree. It broke some
of our own doctests, at least, because the "__doc__" value that we tested
for was no longer the same.

Regarding the "autotestdict", CPython also got smarter and now finds
doctests embedded in C implemented functions all by itself. This is clearly
an improvement compared to the previous behaviour. However, this also means
that it now executes both the doctest of the function itself and its copy
in the generated "__test__" dict (stored in the module under that name),
meaning that it executes all function doctests twice. This also broke some
of Cython's own doctests for us, which modified global state and thus
failed the second time.

I'm yet unsure if we should try to do something about this. Currently, the
explicit doctest dict is generated by default, so all code that uses
doctests in function docstrings suffers from this. We might be able to make
Cython a bit smarter so that these docstrings are left out of the test dict
when (C-)compiling in CPython 3.4. Deciding which ones are still needed
might be a bit tricky, though...

Stefan
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to