Skip to content

fix(jupyter): await Jupyter.display evaluation#20646

Merged
bartlomieju merged 1 commit intodenoland:mainfrom
bartlomieju:jupyter_promise_collected
Sep 23, 2023
Merged

fix(jupyter): await Jupyter.display evaluation#20646
bartlomieju merged 1 commit intodenoland:mainfrom
bartlomieju:jupyter_promise_collected

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

I believe this fixes #20528.

There are a few things happening here:

  1. primitive values are not going through formatting for Jupyter MIME bunndle
  2. evaluation of object[Symbol.for("Jupyter.display")] is wrapped in a try/catch block
  3. evaluation of object[Symbol.for("Jupyter.display")] is awaited

I was unable to reproduce the "Promise was collected" error with this change.

Copy link
Copy Markdown
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. Lgtm


if let Some(data) = get_jupyter_display(session, evaluate_result).await? {
return Ok(data);
// If the response is a primitive value we don't need to try and format
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bartlomieju bartlomieju merged commit b1ca67a into denoland:main Sep 23, 2023
@bartlomieju bartlomieju deleted the jupyter_promise_collected branch September 23, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[repl][jupyter-kernel] {"code":-32000,"message":"Promise was collected"}

3 participants