#17814: Make calling a cached method independent of source code inspection
---------------------------------+------------------------
Reporter: SimonKing | Owner:
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-6.6
Component: distribution | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+------------------------
Changes (by SimonKing):
* component: PLEASE CHANGE => distribution
Old description:
New description:
If a pyx file in the sage library uses cached methods and then the source
file is removed after compiling Sage, then accessing the cached methods in
this file becomes impossible. Example: Move the file
`src/sage/rings/finite_rings/finite_field_base.pyx` away. Then:
{{{
sage: K=GF(5)
sage: K.factored_order
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-2-488672e9c19b> in <module>()
----> 1 K.factored_order()
/home/king/Sage/git/sage/src/sage/structure/parent.pyx in
sage.structure.parent.Parent.__getattr__
(build/cythonized/sage/structure/parent.c:7863)()
838 return self.__cached_methods[name]
839 except KeyError:
--> 840 attr = getattr_from_other_class(self,
self._category.parent_class, name)
841 self.__cached_methods[name] = attr
842 return attr
/home/king/Sage/git/sage/src/sage/structure/misc.pyx in
sage.structure.misc.getattr_from_other_class
(build/cythonized/sage/structure/misc.c:1582)()
249 dummy_error_message.cls = type(self)
250 dummy_error_message.name = name
--> 251 raise dummy_attribute_error
252 try:
253 attribute = getattr(cls, name)
AttributeError: 'FiniteField_prime_modn_with_category' object has no
attribute 'factored_order'
}}}
The same does work in attached pyx files, even after removing the
temporary copy of the pyx file. Conjecture: The cached method's `__get__`
method relies on source code inspection. That should of course not be the
case. Source code inspection should only come in play if the user wants to
see the source code or at least the doc string.
I chose the component "distribution", since it was reported on sage-devel
as something that happened on certain sage distributions that do not
provide sage sources.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/17814#comment:1>
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.