- Upgrade to V8 12.6 from 12.4.
- Fix potential hang if JavaScript calls a function produced by
wrap_py_function
while we're tearing it down.
-
Add optional context manager and
.close()
semantics to PythonMiniRacer
class. -
Fixed a potential hang on MiniRacer teardown if MiniRacer is executing a microtask which loops infinitely.
-
Switch C++ side of MiniRacer to a more straightforward object lifecycle management model.
- Update to V8 12.4. This includes fixes for CVE-2024-3159, CVE-2024-3156, and CVE-2024-2625. These vulnerabilities in V8 would impact PyMiniRacer users who are running untrusted and adversarial JavaScript code.
-
Added support for installing callbacks from JS back into Python, using MiniRacer.wrap_py_function.
-
Refactored the Python implementation into many internal files. This should mostly not present a breaking change, except for code which reaches into internal (
_
-prefixed) variables.
-
Fixed Python crash on long-running microtasks, introduced in v0.8.1 (before which long-running microtasks would probably not run at all).
-
Fixed memory leak on the exception object reported when an
eval
times out. -
Hardened the memory management of JS value interchange, context tracking, and asynchronous task tracking between C++ and Python.
-
Added exhaustive typing (now with a MyPy pre-commit to verify!)
-
Added a test asserting that the v8 sandbox is enabled on all platforms we build wheels for.
-
Added a
MutableMapping
(dict
-like) interface for all derivatives of JS Objects, and aMutableSequence
(list
-like) interface for JS Arrays. You can now use Pythonic idioms to read and write Object properties and Array elements in Python, including recursively (i.e., you can read Objects embedded in other objects, and embed your own). -
Added ability to directly call
JSFunction
objects from Python. E.g.,mr.eval("a => a*a")(4)
parses the given number-squaring code into a function, returns a handle to that function to Python, calls it with the number4
, and recieves the result of16
. -
Added a
JSUndefined
Python object to model JavaScriptundefined
. This is needed to properly implement the above interface for reading Object and Array elements. Unfortunately, this may present a breaking change for users who assume JavaScriptundefined
is modeled as PythonNone
. -
Removed an old optimization for
eval
on simple no-argument function calls (i.e.,myfunc()
). The optimization only delivered about a 17% speedup on no-op calls (and helped relatively less on calls which actually did work), and for the purpose of optimizing repeated calls to the same function, it's now redundant with extracting and calling the function from Python, e.g.,mr.eval("myfunc")()
. -
Hardening (meaning "fixing potential but not-yet-seen bugs") related to freeing
BinaryValue
instances (which convey data from C++ to Python). -
More hardening related to race conditions on teardown of the
MiniRacer
object in the unlikely condition thateval
operations are still executing on the C++ side, and abandoned on the Python side, when Python attempts to garbage collect theMiniRacer
object.
-
Updated to V8 12.3 from V8 12.2 now that Chromium stable is on 12.3.
-
Added Python-side support for JS Promises. You can now return a JS Promise from code executed by
MiniRacer.eval
, and PyMiniRacer will convert it to a Python object which has a blockingpromise.get()
method, and also supportsawait promise
inasync
Python functions. -
Added a
setTimeout
andclearTimeout
. These common functions live in the Web API standard, not the ECMAScript standard, and thus don't come with V8, but they're so ubiquitious we now ship an implemention withPyMiniRacer
.
-
Revamped JS execution model to be out-of-thread. Python/C++ interaction now happens via callbacks.
-
Consequently, Control+C (
KeyboardInterrupt
) now interrupts JS execution. -
Hardened C++-side thread safety model, resolving potential race conditions introduced in v0.8.1 (but not actually reported as happening anywhere).
-
Further improved JS exception reporting; exception reports now show the offending code where possible.
-
Introduced
timeout_sec
parameter toeval
,call
, andexecute
to replace thetimeout
, which unfortunately uses milliseconds (unlike the Python standard library). In the future we may emit deprecation warnings for use oftimeout
.
- A series of C++ changes which should not impact the behavior of PyMiniRacer:
- Refactoring how we use V8 by inverting the control flow. Before we had function evaluations which ran and drained the message loop. Now we have an always-running message loop into which we inject function evaluations. This seems to be the preferred way to use V8. This is not expected to cause any behavior changes (but, in tests, makes microtask competion more consistent).
- Refactoring the C++ implementation into multiple components to make startup and teardown logic more robust.
- Added tests for the existing fast-function-call path.
- Also, simplified Python conversion of C++ evaluation results.
- General overhaul of C++ implementation to better adhere to modern best practice. This should have no visible impact except for the following notes...
- Exposed the hard memory limit as a context-specific (as opposed to
eval
-specific) limit, since that's how it worked all along anyway. Themax_memory
eval
argument still works for backwards compatibility purposes. - Correct message type of some exceptions to
str
instead ofbytes
(they should all bestr
now). - Added better messages for JS parse errors.
- Added backtraces for more JS errors.
- Added some really basic Python typing.
- Update V8 to 12.2
- Drop Python 2 support
- Fix small Python 3.12 issue and add testing for Python 3.9-3.12
- Add aarch64 support for Mac and Linux
- Revamp DLL loading to be compliant with Python 3.9-style resource loading. This may
present a small breaking change for advanced usage; the
EXTENSION_PATH
andEXTENSION_NAME
module variables, andMiniRacer.v8_flags
andMiniRacer.ext
class variable have all been removed. - Add support for the ECMAScript internalization API and
thus the ECMA
Intl
API - Use fast startup snapshots
- Switch from setuptools to Hatch
- Switch from tox to Hatch
- Switch from flake8 and isort to Hatch's wrapper of Ruff
- Switch from Sphinx to mkdocs (and hatch-mkdocs)
- Switch from unittest to pytest
- Add ARCHITECTURE.md and lots of code comments
- Update V8 to 8.9
- Optimize function calls without arguments
- Switch V8 to single threaded mode to avoid crashes after fork
- Switch to strict mode by default
- Revamp documentation
- Update V8 to 8.8
- Universal wheels for Linux, Mac and Windows
- Fallback to source package for Alpine Linux
- Introduce a strict mode
- Fix array conversion when size changes dynamically (CVE-2020-25489)
- Support for Alpine Linux
- Avoid pip private modules in setup.py
- Support for Windows 64 bits
- Support for Python 3.8
- Upgrade V8 to 7.8
- Support soft memory limits
- Support memory and time limits
- Upgrade libv8
- Fix a memory leak
- Add wheel for Python without PyMalloc
- Add wheel for Python 3.7
- Add support for pip 10
- Update package metadata
- Add heap_stats function
- Fix issue with returned strings containing null bytes
- Remove dependency to enum
- Add compatibility for centos6
- Add the possibility to pass a custom JSON encoder in call.
- Fix the compilation for Ubuntu 12.04 and glibc < 2.17.
- Update targets build for better compatibility with old Mac OS X and linux platforms.
- Improve general performances of the JS execution.
- Add the possibility to build a different version of V8 (for example with debug symbols).
- Fix a conflict that could happens between statically linked libraries and dynamic ones.
- Add error message when py_mini_racer sdist fails to build asking to update pip in order to download the pre-compiled wheel instead of the source distribution.
- Build py_mini_racer against a static Python. When built against a shared library python, it doesn't work with a static Python.
- Ensure JSEvalException message is converted to unicode
- Fix extension loading for python3
- Add a make target for building distributions (sdist + wheels)
- Fix eval conversion for python 3
- Fix date support
- Fix Dockerfile for generating python3 wheels
- Fix sdist distribution.
- First release on PyPI.