fix: running a block whose last value is a date, Decimal or object shows the value instead of an error (#32682)

This commit is contained in:
G30 2026-10-20 13:22:24 -04:00 • committed by GitHub
parent d4d5bc2ef5
commit fb5eec56dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -92,7 +92,10 @@ const sandboxScript = String.raw`
if (['string', 'number', 'boolean'].includes(typeof value)) return value;
if (typeof value === 'bigint') return value.toString();
if (Array.isArray(value)) return value.map(clean);
if (typeof value.toJs === 'function') return clean(value.toJs());
if (typeof value.toJs === 'function') {
const converted = value.toJs();
return typeof converted?.toJs === 'function' ? converted.toString() : clean(converted);
}
if (typeof value === 'object') {
const out = {};
for (const key in value) {

View file

@ -346,7 +346,10 @@ function processResult(result: any): any {
}
if (typeof result.toJs === 'function') {
// If it's a Pyodide proxy object (e.g., Pandas DF, Numpy Array), convert to JS and process recursively
return processResult(result.toJs());
const converted = result.toJs();
return typeof converted?.toJs === 'function'
? converted.toString()
: processResult(converted);
}
if (typeof result === 'object') {
// Convert JS objects to a recursively serialized representation