-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Technical post about exception handling in Pyodide's ffi #43
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for pyodide-blog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hoodmane! It was very fun to read. Probably this post is not very easy to read for those who are not familiar with both languages and its internals, but it would be very helpful for some people who are interested in Pyodide internals and future contributors.
The contents of the post generally looks good to me. I left some minor comments.
setPythonErrorFromJsError(e); \ | ||
return -1; \ | ||
} \ | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | ||
and making these replacements breaks some JavaScript code. We need a version of | ||
these macros that works equally well in both C and JavaScript. Since `!!1` | ||
evaluates to `true` in JavaScript and `1` in C, the following definitions work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow didn't know about this... it is really tricky to deal with C macros :)
|
||
## Implementing `setPythonErrorFromJsError` | ||
|
||
We can call C functions from JavaScript with an extra leading `_`. A simplified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was because Emscripten put the underscore prefix, right? I guess we should mention that why there is leading underscore.
|
||
## Conclusion | ||
|
||
??? What should we say here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe adding some future plans or briefly mentioning some weird cases that are not handled in this post (c++ exceptions?) would be nice?
No description provided.