3 ms·
PyMiniRacer: Embedding JavaScript into Python
- type0 10y agotl;dr: PyMiniRacer bundles a plain V8. It uses its C++ interface to communicate with it. Executing a JavaScript string in a given context is done with the following steps: 1. Take the JavaScript input as a Python string (in the MiniRacer.eval Python method); 2. Pass it to V8 after a String::NewFromUtf8 conversion; 3. Then V8: - compiles it with Script::Compile; - executes it with Script::Run; 4. PyMiniRacer converts the result to an abstract binary interface; 5. Return it to Python that will convert it using ctypes.
- zetaben 10y agoRelated show HN: https://news.ycombinator.com/item?id=12210299 https://news.ycombinator.com/item?id=12210299