diff --git a/html/package-lock.json b/html/package-lock.json
index 54d676e5..78d6b326 100644
--- a/html/package-lock.json
+++ b/html/package-lock.json
@@ -4634,9 +4634,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001434",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz",
- "integrity": "sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==",
+ "version": "1.0.30001625",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz",
+ "integrity": "sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w==",
"funding": [
{
"type": "opencollective",
@@ -4645,6 +4645,10 @@
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
}
]
},
@@ -18470,9 +18474,9 @@
}
},
"caniuse-lite": {
- "version": "1.0.30001434",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz",
- "integrity": "sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA=="
+ "version": "1.0.30001625",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz",
+ "integrity": "sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w=="
},
"canvas": {
"version": "2.11.2",
diff --git a/plugin/PySrc/space_tracer/code_tracer.py b/plugin/PySrc/space_tracer/code_tracer.py
index a0985fd7..52aab4e9 100644
--- a/plugin/PySrc/space_tracer/code_tracer.py
+++ b/plugin/PySrc/space_tracer/code_tracer.py
@@ -1,11 +1,12 @@
from ast import (arg, fix_missing_locations, iter_fields, Add, Assign,
- AST, Attribute, BitAnd, BitOr, BitXor, Call, Div, Ellipsis,
+ AST, Attribute, BitAnd, BitOr, BitXor, Call, Div,
ExceptHandler, Expr, ExtSlice, FloorDiv, ImportFrom, Index,
List, Load, LShift, Mod, Mult, Name, NodeTransformer,
- Pow, Raise, Return, RShift, Slice, Starred, Store, Str, Sub,
+ Pow, Raise, Return, RShift, Slice, Starred, Store, Sub,
Subscript, Try, Tuple, Yield)
from copy import deepcopy
from ast import FormattedValue, Constant
+import sys
try:
from ast import MatchAs, MatchSequence, MatchStar # type: ignore
@@ -13,6 +14,11 @@
# Not available before Python 3.10
MatchAs = MatchSequence = MatchStar = None # type: ignore
+if sys.version_info < (3, 12):
+ from ast import Ellipsis
+else:
+ Ellipsis = None
+
CONTEXT_NAME = '__live_coding_context__'
RESULT_NAME = '__live_coding_result__'
@@ -186,18 +192,20 @@ def _wrap_slice(self, subscript_node, index_to_get=None):
format_text = ', '.join(self._wrap_slice(subscript)[0]
for subscript in subscripts)
slice_node.elts = [subscript.slice for subscript in subscripts]
- elif isinstance(slice_node, (Index, Ellipsis)):
- if (isinstance(slice_node, Ellipsis) or
- isinstance(slice_node.value, Ellipsis)):
- index_to_get = None
- format_text = '...'
- else:
- slice_node.value = self._wrap_assignment_index(
- slice_node.value,
- index_to_get)
- format_text = '{!r}'
- if index_to_get is not None:
- index_to_get -= 1
+ elif (Ellipsis is not None and isinstance(slice_node, Index) and
+ isinstance(slice_node.value, Ellipsis)):
+ index_to_get = None
+ format_text = '...'
+ elif isinstance(slice_node, Constant) and slice_node.value is ...:
+ index_to_get = None
+ format_text = '...'
+ elif isinstance(slice_node, Index):
+ slice_node.value = self._wrap_assignment_index(
+ slice_node.value,
+ index_to_get)
+ format_text = '{!r}'
+ if index_to_get is not None:
+ index_to_get -= 1
else:
# Python 3.9 stopped wrapping many things in an Index object, so
# subscript_node.slice could be a Constant, BinOp, UnaryOp, or Call.
@@ -494,7 +502,9 @@ def visit_FunctionDef(self, node):
context_assign = Assign(targets=[Name(id=CONTEXT_NAME, ctx=Store())],
value=start_frame_call)
new_node.body = [context_assign]
- if isinstance(try_body[0], Expr) and isinstance(try_body[0].value, Str):
+ if (isinstance(try_body[0], Expr) and
+ isinstance(try_body[0].value, Constant) and
+ isinstance(try_body[0].value.value, str)):
# Move docstring back to top of function.
# noinspection PyUnresolvedReferences
new_node.body.insert(0, try_body.pop(0))
@@ -532,7 +542,8 @@ def _is_module_header(statement):
if isinstance(statement, ImportFrom):
return statement.module == '__future__'
if isinstance(statement, Expr):
- return isinstance(statement.value, Str)
+ return (isinstance(statement.value, Constant) and
+ isinstance(statement.value.value, str))
return False
def visit_Module(self, node):