Skip to content

Commit e1b1eef

Browse files
committed
fixed syntax error handling, which got broken on prior commit
1 parent 33e3ceb commit e1b1eef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

custom_components/pyscript/jupyter_kernel.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def decode(msg):
260260
msg['content'] = decode(msg_frames[3])
261261
check_sig = self.msg_sign(msg_frames)
262262
if check_sig != m_signature:
263-
_LOGGER.debug("check_sig=%s, m_signature=%s, wire_msg=%s", check_sig, m_signature, wire_msg)
263+
_LOGGER.error("signature mismatch: check_sig=%s, m_signature=%s, wire_msg=%s", check_sig, m_signature, wire_msg)
264264
raise ValueError("Signatures do not match")
265265

266266
return identities, msg
@@ -355,6 +355,10 @@ async def shell_handler(self, shell_socket, full_msg):
355355
exc = self.ast_ctx.get_exception_obj()
356356
if exc:
357357
traceback_mesg = self.ast_ctx.get_exception_long().split("\n")
358+
359+
if msg['content'].get("store_history", True):
360+
self.execution_count += 1
361+
358362
metadata = {
359363
"dependencies_met": True,
360364
"engine": self.engine_id,
@@ -374,8 +378,11 @@ async def shell_handler(self, shell_socket, full_msg):
374378
del content["execution_count"], content["status"]
375379
await self.send(self.iopub_socket, 'error', content, parent_header=msg['header'])
376380

377-
if msg['content'].get("store_history", True):
378-
self.execution_count += 1
381+
content = {
382+
'execution_state': "idle",
383+
}
384+
await self.send(self.iopub_socket, 'status', content, parent_header=msg['header'])
385+
return
379386

380387
# if True or isinstance(self.ast_ctx.ast, ast.Expr):
381388
_LOGGER.debug("Executing: '%s' got result %s", code, result)

0 commit comments

Comments
 (0)