Technical post about exception handling in Pyodide's ffi#43
Conversation
✅ Deploy Preview for pyodide-blog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
ryanking13
left a comment
There was a problem hiding this comment.
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; \ | ||
| } \ | ||
| }) |
| ``` | ||
| 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.
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.
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.
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.