Skip to content

Commit 48ab5fb

Browse files
committed
Factor out self.options.file[0]
1 parent c65be3b commit 48ab5fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sage/cli/run_file_cmd.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ def run(self) -> int:
4040
r"""
4141
Execute the given command.
4242
"""
43-
input_file = preparse_file_named(self.options.file[0]) if self.options.file[0].endswith('.sage') else self.options.file[0]
44-
if self.options.file[0].endswith('.pyx') or self.options.file[0].endswith('.spyx'):
43+
input_file = self.options.file[0]
44+
if input_file.endswith('.sage'):
45+
input_file = str(preparse_file_named(input_file))
46+
if input_file.endswith('.pyx') or input_file.endswith('.spyx'):
4547
s = load_cython(input_file)
4648
eval(compile(s, tmp_filename(), 'exec'), sage_globals())
4749
else:

0 commit comments

Comments
 (0)