Skip to content

Commit de449ef

Browse files
committed
ensure lineno is inside code_list[]; with lambda function or eval it might not be
1 parent 235b563 commit de449ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

custom_components/pyscript/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2002,7 +2002,7 @@ def format_exc(self, exc, lineno=None, col_offset=None, short=False, code_list=N
20022002
"""Format an multi-line exception message using lineno if available."""
20032003
if code_list is None:
20042004
code_list = self.code_list
2005-
if lineno is not None:
2005+
if lineno is not None and lineno <= len(code_list):
20062006
if short:
20072007
mesg = f"In <{self.filename}> line {lineno}:\n"
20082008
mesg += " " + code_list[lineno - 1]

0 commit comments

Comments
 (0)