Opened 9 years ago

Last modified 6 years ago

#12979 new defect

Introspection with wildcards should be careful with the evaluation of attributes

Reported by: nthiery Owned by: was
Priority: major Milestone: sage-6.4
Component: interfaces Keywords: introspection, wildcards
Cc: sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

    sage: I.*conj*?
    Traceback (most recent call last):
    KABOOOM
    TypeError: expressions containing only a numeric coefficient, constant or symbol have no operands

Behind the scene, I.*conj*? currently evaluates all attributes of I. However some lazy attribute, or more generally properties, may trigger an error in the process; here it is:

sage: I.op
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "expression.pyx", line 4048, in sage.symbolic.expression.Expression.op.__get__ (sage/symbolic/expression.cpp:18034)
TypeError: expressions containing only a numeric coefficient, constant or symbol have no operands

This issue prevents introspection for quite simple objects. There certainly are use cases where evaluating all attributes would not raise errors, but could be prohibitively long (more than 1s is almost unacceptable for interactive introspection).

At the minimum, introspection should trap those errors, and ignore them gracefully. Maybe it should even not evaluate at all the attributes, and just use dir.

Change History (4)

comment:1 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.