You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heya I think PyNode is almost the best to do python-JS Interop in a light-weighted, fast way!!!
However, one problem I encountered was that there would be a segmentation fault raised if we failed to ensure that pynode.startInterpreter() was called only once. I believe that this is because the GIL is released when calling pynode.startInterpreter() again and PyUnicode_DecodeFSDefault("pynode"); in the function requires GIL.
In most cases, PyNode works very well because I put the initialized pynode (with interpreter started and syspath added) in a module, like:
// in util.jsfunctionloadPyNode(){constpynode=require('@fridgerator/pynode');pynode.startInterpreter();returnpynode;}module.exports={
pynode
}// in A.test.jsconst{ pynode }=require('./utils');// test suite 1// in B.test.jsconst{ pynode }=require('./utils');// test suite 2
However, when I was doing unit tests by jest and there were multiple test files, utils.js was called for each test file, even if the test files were actually executed in the same subprocess, which led to duplicated calling of startInterpreter and thus segmentation fault.
The text was updated successfully, but these errors were encountered:
I've opened a PR (#37 ) trying to fix this, and it works for my project on both Mac OS and Ubuntu 18.04 using python 3.8 & Node 16. Hope this could make pynode more robust.
Heya I think PyNode is almost the best to do python-JS Interop in a light-weighted, fast way!!!
However, one problem I encountered was that there would be a segmentation fault raised if we failed to ensure that
pynode.startInterpreter()
was called only once. I believe that this is because the GIL is released when callingpynode.startInterpreter()
again andPyUnicode_DecodeFSDefault("pynode");
in the function requires GIL.In most cases, PyNode works very well because I put the initialized
pynode
(with interpreter started and syspath added) in a module, like:However, when I was doing unit tests by
jest
and there were multiple test files,utils.js
was called for each test file, even if the test files were actually executed in the same subprocess, which led to duplicated calling ofstartInterpreter
and thus segmentation fault.The text was updated successfully, but these errors were encountered: