New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make sage_getsourcelines and sage_getfile consistent #16382
Comments
Branch: u/nbruin/ticket/16382 |
comment:1
OK, first try for implementing a |
comment:2
Also, note:
which is currently relied on to detect a dynamic class instance. The method in question tries to make a static method, but the subsequent inclusion into a dynamic class dictionary seems to break this (hence, the method binds anyway and the call receives an unexpected If one fixes Attempt to show that
As you can see:
New commits:
|
Commit: |
comment:3
The implementation of |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
This commit should fix the problem for dynamic classes derived from cdef classes. For those, the |
comment:6
In case someone wants to fix the fact that staticmethods on dynamicclasses end up binding anyway: I suspect the problem occurs somewhere in
As you can see, the standard staticmethod getter returns the wrapped function object. However, functions ALWAYS have a getter method that binds them. So if an staticmethod attribute inadvertently is "got" twice (first retrieved from the "other" class, and then passed through its own getter another time), one would end up binding a static method. Fixing this is not within the scope of this ticket, though. |
comment:8
failing doctest, see patchbot report |
We presently have:
The problem is that
hyperbolic_triangle
is wrapped and its source is provided by a_sage_src_lines_()
method, but on thegetfile
front, there is no analogue, so the file isn't found. That meansedit
doesn't work properly.One solution is to provide a parallel method
_sage_src_file_()
. Another, which requires more editing, is to changesage_getsourcelines
to return a triple([lines],lineno,filename)
instead of([lines],lineno)
as it does now (it's a little strange to return a line number without the file into which this indexes anyway). Note thatfilename
could end up being something that doesn't actually open, because interactively defined classes get funny "filenames" that, via theinspect
linecache, actually can used to index source lines without having a file correspond to them.CC: @simon-king-jena @nthiery @roed314
Component: misc
Branch/Commit: u/nbruin/ticket/16382 @
31c39fa
Issue created by migration from https://trac.sagemath.org/ticket/16382
The text was updated successfully, but these errors were encountered: