#8296: getattr hack not failing graciously on descriptors / tab completion
broken
in emacs
---------------------------------+------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.3.3
Component: misc | Keywords: tab completion, dir, getattr
Author: Nicolas M. ThiƩry | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------------+------------------------------------------
Description changed by nthiery:
Old description:
> The getattr hack of #7981 to let extension types "inherit" from
> category does not fail graciously on descriptors.
>
> Visible effect: tab completion is broken under emacs:
>
> {{{
> sage: n=1
> sage: n.<tab> # gives nothing
> }}}
>
> This is a variant of #8223. Emacs does not use dir straight away, but
> instead calls _ip.IP.magic_psearch which is conservative and does not
> trust dir. So it actually tries to get all advertised attributes, and
> in particular the descriptor __weakref__ which failed on 1 and
> confused getattr.
>
> The attached patch makes the getattr fail graciously in such
> situations. It probably would be better for __weakref__ to not appear
> in dir in the first place, but at least this should fix the bug and
> variants thereof.
New description:
The getattr hack of #7981 to let extension types "inherit" from category
does not fail graciously on descriptors.
Visible effect: tab completion is broken under emacs:
{{{
sage: n=1
sage: n.<tab> # gives nothing
}}}
This is a variant of #8223. Emacs does not use dir straight away, but
instead calls _ip.IP.magic_psearch which is conservative and does not
trust dir. So it actually tries to get all advertised attributes, and in
particular the descriptor __weakref__ which failed on 1 and confused
getattr.
The attached patch makes the getattr fail graciously in such situations.
It probably would be better for __weakref__ to not appear in dir in the
first place, but at least this should fix the bug and variants thereof.
Again, better implementations of the getattr hack are most welcome. See
comments in the code.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8296#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.