On Mon, May 12, 2008 at 11:17 AM, Nick Alexander <[EMAIL PROTECTED]> wrote: > > > On 12-May-08, at 11:10 AM, Nathan Dunfield wrote: > > > >> Oh, that's annoying, it doesn't display the Cython command line. > >> Anyway, if you don't give the -p or --embed-positions option to > >> Cython, then source introspection should *not* work: > > > > I cython'd on the command line with the -p option and then setup.py > > installed. > > > > I now get a different error message when I try introspection: > > > > sage: import introtest > > sage: introtest.intro?? > > Error getting source: s must be a string > > > > instead of > > > > Error getting source: arg is not a module, class, method, function, > > > > Does the introtest.pyx file have to copied to somewhere in particular > > for this to work, or is everything supposed to embedded in the *.so > > module binary? > > It is supposed to be embedded. Could you tell me what > introtest.intro.__doc__ is? The embedding just includes the file > info; for example > > sage: Integer.__doc__[0:100] > 'File: sage/rings/integer.pyx (starting at line 241)\n\n The \ > \class{Integer} class represents arbitr' > > That shows where the docstring starts in sage/rings/integer.pyx for > class Integer. There are lots of way that info can be off, or that > Sage can misparse/not find it. It's somewhat fragile.
I think the problem is that Sage's foo?? specifically *assumes* that the file refers to a file in the site-packages directory, or maybe even in the sage site-packages directory. Thus if somebody just builds a pyx file somewhere that assumption isn't satisfied. Anyway Nick, you and I both wrote this, but that was a year ago, and we'll both going on memory. I think the short answer like you said is that it should not be guaranteed to work unless the file is listed in devel/sage/sage/setup.py, and that we'll have to extend the functionality so it works more generally. This will require modifications in misc/*.py (for the command line) and server/support.py (for the notebook). William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---