v2.
EvaluateResult does not need a name, just as what Tom pointed out in
previous review. It's only the *children* that need to be made sure that
their names are valid. An identifier for a variable, can't ever have an
integer as a name, anyhow (not as far as I am aware, no programming
languages allow for that).
Removed the f-strings and use str() instead as pointed out that
f-strings might not be supported fully.
v1.
This patch fixes a few bugs.
First of all, name of VariableReferences must always be of string type.
This patch makes sure that this is the case by formatting the name. If
(when) the name is an integer, this will cause clients to fail or throw
errors.
Fixes a bug in NoOpArrayPrinter that calculated children to be N, but
only ever retrieves N-1 children, which makes Python at some time later
(during fetch_children -> fetch_one_child(N) ) raise an exception (out
of list index) which makes the entire request go bad.
The result[self.result_name] also f-strings the printer.to_string()
value, because this can potentially be a LazyString (which is a Python
object, not a string) and is not serializable by json.dumps.
Approved-By: Tom Tromey <tom@tromey.com>
"variablesReference": self.ref,
}
if self.name is not None:
- result["name"] = self.name
+ result["name"] = str(self.name)
return result
def no_children(self):
return "array"
def children(self):
- for i in range(self.low, self.high):
+ for i in range(self.low, self.high + 1):
yield (i, self.value[i])