Does Cython inject lines in __doc__?

31 views
Skip to first unread message

Nathann Cohen

unread,
Sep 30, 2015, 10:57:10 AM9/30/15
to Sage devel, David Coudert
Hello everybody,

David reported a problem about #19061, a ticket which will help us
maintain a thematic index of function in a module file.

The problem is the following:

Is Cython injecting lines in our documentation?

For instance:

sage: cat a.pyx
def a():
r"""
Test
"""
pass
sage: %runfile a.pyx
sage: print a.__doc__
File: _home_ncohen_a_pyx_0.pyx (starting at line 6)

Test

As you can see, the line "File: ..." was added in the meantime.

Is this done by Cython? Is this done by us?

Is there a preferred way to filter those lines out, or should I do the
ugly thing and ignore lines of doc that do not start with at least
four spaces ? :-/

Thanks for your help,

Nathann

Jeroen Demeyer

unread,
Sep 30, 2015, 11:06:36 AM9/30/15
to sage-...@googlegroups.com
On 2015-09-30 16:57, Nathann Cohen wrote:
> Is this done by Cython?
Yes.

And Sage really needs this to implement "??". It's ugly, but it's the
only possible place to store such metadata for extension types.

> Is there a preferred way to filter those lines out
See _extract_embedded_position() in src/sage/misc/sageinspect.py

Nathann Cohen

unread,
Sep 30, 2015, 11:19:30 AM9/30/15
to Sage devel
> And Sage really needs this to implement "??". It's ugly, but it's the only
> possible place to store such metadata for extension types.

I see :-/

> See _extract_embedded_position() in src/sage/misc/sageinspect.py

Thank you. I used it in the commit I added on #19061.

Nathann
Reply all
Reply to author
Forward
0 new messages