You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This output can be seen by commenting out the last line, i.e. by running
exec("n = 6")
print(n)
print(type(n))
Actual Behavior
Returns error
<function numerical_approx at 0x7f2775c46d40>
<class 'function'>
Traceback (most recent call last):
File "/home/pranav/bug/main.sage.py", line 11, in <module>
ls = [i for i in range(n)]
^^^^^^^^
TypeError: 'function' object cannot be interpreted as an integer
shell returned 1
Additional Information
This issue only occurs if the variable is created by the exec function. Further, trying to run n = Integer(n) immediately after the exec statement is not useful since sage already assumes n to be a function
Environment
OS: NixOS 24.05
Sage Version: SageMath version 10.5, Release Date: 2024-12-04
Checklist
I have searched the existing issues for a bug report that matches the one I want to file, without success.
I have read the documentation and troubleshoot guide
The text was updated successfully, but these errors were encountered:
I cannot reproduce the problem: I get the correct output in both cases (with the final line and without). This is with sagemath 10.6.beta2 on MacOS 14.6.1.
Steps To Reproduce
Run
using
sage main.sage
Expected Behavior
Should output
This output can be seen by commenting out the last line, i.e. by running
Actual Behavior
Returns error
Additional Information
This issue only occurs if the variable is created by the exec function. Further, trying to run
n = Integer(n)
immediately after theexec
statement is not useful since sage already assumesn
to be a functionEnvironment
Checklist
The text was updated successfully, but these errors were encountered: