Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
23684: Improve error message with some called expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Aug 23, 2017
1 parent 037272c commit bf1a112
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sage/symbolic/expression.pyx
Expand Up @@ -5333,7 +5333,7 @@ cdef class Expression(CommutativeRingElement):
sage: ( 2^(8/9) - 2^(1/9) )(x-1)
Traceback (most recent call last):
...
ValueError: the number of arguments must be less than or equal to 0
ValueError: failed attempt to make a function call on an expression without variables
"""
return len(self.arguments())

Expand Down
4 changes: 3 additions & 1 deletion src/sage/symbolic/ring.pyx
Expand Up @@ -937,7 +937,7 @@ cdef class SymbolicRing(CommutativeRing):
sage: a(4)
Traceback (most recent call last):
...
ValueError: the number of arguments must be less than or equal to 0
ValueError: failed attempt to make a function call on an expression without variables
Note that you make get unexpected results when calling
Expand Down Expand Up @@ -965,6 +965,8 @@ cdef class SymbolicRing(CommutativeRing):
d = {}

vars = _the_element.variables()
if len(vars) == 0:
raise ValueError("failed attempt to make a function call on an expression without variables")
for i, arg in enumerate(args):
try:
d[ vars[i] ] = arg
Expand Down

0 comments on commit bf1a112

Please sign in to comment.