Skip to content

RSolve no longer Get'able - related to SetDelayed assignment evaluation? #1820

@rocky

Description

@rocky

Description

RSolve gives a Python traceback in loading with Get/Needs.

How to Reproduce and Output Given

$ mathics3 --post-mortem

Mathics3 10.0.1dev0
Running on linux CPython 3.13.12 (main, Feb  7 2026, 20:16:33) [GCC 13.3.0]
using SymPy 1.14.0, mpmath 1.3.0, numpy 2.4.2, cython 3.2.4, scipy 1.17.0, skimage 0.26.0
...
In[1]:= LoadModule["pymathics.trepan"]
Out[1]= "pymathics.trepan"
In[2]:= Get["mathics/Packages/DiscreteMath/RSolve.m", Trace->True]
Reading file: mathics/Packages/DiscreteMath/RSolve.m

2: (* :Title: RSolve *)
4: (* :Author:  Marko Petkovsek *)
...
2398: iSeriesTerm[HypergeometricPFQ[aList_, bList_, c_. z_], z_Symbol, n_] := ...
Traceback (most recent call last):
  File "mathics3", line 7, in <module>
    sys.exit(main())
             ~~~~^^
...
  File "mathics/core/rules.py", line 417, in apply_function
    result = self.function(evaluation=evaluation, **vars_noctx) or expression
             ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mathics/builtin/specialfns/hypergeom.py", line 207, in eval
    return eval_HypergeometricPQF(a, b, z)
  File "mathics/eval/specialfns/hypergeom.py", line 108, in eval_HypergeometricPQF
    and hasattr(a[0], "is_zero")
                ~^^^
TypeError: 'Expression' object is not subscriptable
Uncaught exception. Entering post-mortem debugger...
(/src/external-vcs/github/Mathics3/mathics-core/mathics/eval/specialfns/hypergeom.py:108:21 @66): eval_HypergeometricPQF
!! 108         and hasattr(a[0], "is_zero")

(Trepan3k:pm) load trepan3k_mathics3
loaded command: "mabort"
...
(Trepan3k:pm) mbt -b
B:0 (1) HypergeometricPFQ[a_, b_, z_]

          file 'mathics/builtin/specialfns/hypergeom.py' at line 207, column 16
B:1 (39) SetDelayed[]

           file 'mathics/eval/assignments/assignment.py' at line 119, column 5
B:2 (40) SetDelayed[]

           file 'mathics/builtin/assignments/assignment.py' at line 225, column 12
B:3 (70) Get[path_String, OptionsPattern[Get]]

           file 'mathics/builtin/files_io/files.py' at line 448, column 16
	   
(Trepan3k:pm) a.elements
(<Symbol: DiscreteMath`RSolve`Private`aList>, <Expression: <Symbol: System`Blank>[]>)
(Trepan3k:pm) pe -p a.elements
tuple(aList, _)

Expected behavior

No traceback.

Additional context

RSolve didn't used to crash. Git bisect will help determine which change caused this to break.

I wonder if this related to the Hold problem in LHS evaluation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions