Opened 12 years ago

Closed 12 years ago

#8296 closed defect (fixed)

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

Reported by: nthiery Owned by: nthiery
Priority: blocker Milestone: sage-4.3.4
Component: misc Keywords: tab completion, dir, getattr
Cc: sage-combinat Merged in: sage-4.3.4.alpha1
Authors: Nicolas M. Thiéry Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by nthiery)

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.

Attachments (1)

trac_8296-fix-tab-completion-emacs-nt.patch (3.3 KB) - added by nthiery 12 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by nthiery

  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 12 years ago by nthiery

  • Description modified (diff)
  • Summary changed from tab completion broken in emacs to getattr hack not failing graciously on descriptors / tab completion broken in emacs

Changed 12 years ago by nthiery

comment:3 Changed 12 years ago by nthiery

  • Description modified (diff)

comment:4 Changed 12 years ago by nthiery

  • Priority changed from major to blocker

comment:5 Changed 12 years ago by mhansen

  • Reviewers set to Mike Hansen
  • Status changed from needs_review to positive_review

Looks good to me.

comment:6 Changed 12 years ago by mhansen

  • Merged in set to sage-4.3.4.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.