Skip to content
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

getattr hack not failing graciously on descriptors / tab completion broken in emacs #8296

Closed
nthiery opened this issue Feb 17, 2010 · 7 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented Feb 17, 2010

The getattr hack of #7921 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.

CC: @sagetrac-sage-combinat

Component: misc

Keywords: tab completion, dir, getattr

Author: Nicolas M. Thiéry

Reviewer: Mike Hansen

Merged: sage-4.3.4.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/8296

@nthiery nthiery added this to the sage-4.3.4 milestone Feb 17, 2010
@nthiery nthiery self-assigned this Feb 17, 2010
@nthiery

This comment has been minimized.

@nthiery

This comment has been minimized.

@nthiery nthiery changed the title tab completion broken in emacs getattr hack not failing graciously on descriptors / tab completion broken in emacs Feb 17, 2010
@nthiery
Copy link
Contributor Author

nthiery commented Feb 17, 2010

@nthiery

This comment has been minimized.

@mwhansen
Copy link
Contributor

mwhansen commented Mar 8, 2010

comment:5

Looks good to me.

@mwhansen
Copy link
Contributor

mwhansen commented Mar 8, 2010

Reviewer: Mike Hansen

@mwhansen
Copy link
Contributor

mwhansen commented Mar 8, 2010

Merged: sage-4.3.4.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants