Skip to content

Commit

Permalink
Fix $InputFileName
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Piras committed Feb 4, 2024
1 parent 9fd4f37 commit 132be71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mathics/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,8 @@ def read_from_stream(stream, word_separators, msgfn, accepted=None):
break

word += tmp


def set_inputfile(filename):
global INPUTFILE_VAR
INPUTFILE_VAR = filename
3 changes: 2 additions & 1 deletion mathics/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from mathics.core.expression import Expression
from mathics.core.load_builtin import import_and_load_builtins
from mathics.core.parser import MathicsFileLineFeeder, MathicsLineFeeder
from mathics.core.read import channel_to_stream
from mathics.core.read import channel_to_stream, set_inputfile
from mathics.core.rules import BuiltinRule
from mathics.core.streams import stream_manager
from mathics.core.symbols import SymbolNull, strip_context
Expand Down Expand Up @@ -423,6 +423,7 @@ def dump_tracing_stats():
definitions.set_line_no(0)

if args.FILE is not None:
set_inputfile(args.FILE.name)
feeder = MathicsFileLineFeeder(args.FILE)
try:
while not feeder.empty():
Expand Down

0 comments on commit 132be71

Please sign in to comment.