#16382: make sage_getsourcelines and sage_getfile consistent
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.3
Component: misc | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/nbruin/ticket/16382 | 31c39fa6b19982e0d189e7eef7aedc3816eb2ffc
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
In case someone wants to fix the fact that staticmethods on dynamicclasses
end up binding anyway: I suspect the problem occurs somewhere in
`getattr_from_other_class`, and it's probably an issue that the "getter"
gets used twice. To illustrate:
{{{
sage: class T(object):
@staticmethod
def stat():
pass
....:
sage: t=T()
sage: t.stat
<function __main__.stat>
sage: T.__dict__['stat']
<staticmethod at 0x7009210>
sage: T.__dict__['stat'].__get__(t)
<function __main__.stat>
sage: T.__dict__['stat'].__get__(t).__get__(t)
<bound method ?.stat of <__main__.T object at 0x6ff0510>>
}}}
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.
--
Ticket URL: <http://trac.sagemath.org/ticket/16382#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.