API Constants
Enums and constant values for loads()
/dumps()
SerializationFeature
SerializationFeature()
Changes to serialization within format versions that affect compatibility.
V8 makes changes to its serialization format without bumping the version number, and these changes affect backwards compatibility by making versions before the change unable to deserialize data encoded by versions with the change.
(Based on comments in V8’s value-serializer.cc code) V8’s compatibility policy is that data written by older versions must be deserializable by newer versions, but does not require that data written by newer versions is deserializable by older versions. To remain compatible with older versions, it’s necessary to avoid writing data with features newer than the earliest version of V8 that needs to read serialized data.
In general, only writing features that existed at the point that a new format version was released will ensure that all V8 versions will continue to be able to read the data in the future.
This flag names the format changes that have occurred, to allow enabling and disabling support for them when encoding data.
Examples
>>> SerializationFeature.MaxCompatibility.first_v8_version
<Version('10.0.29')>
>>> version = SerializationFeature.CircularErrorCause.first_v8_version
>>> version
<Version('12.1.109')>
>>> list(SerializationFeature.supported_by(v8_version=version))
<SerializationFeature.RegExpUnicodeSets: 1>, <SerializationFeature.ResizableArrayBuffers: 2>, <SerializationFeature.CircularErrorCause: 4>] [
Attributes
Name | Description |
---|---|
CircularErrorCause | Allow Errors to self-reference in their cause . |
Float16Array | Support for encoding typed array views holding Float16 elements. |
MaxCompatibility | The first version supporting V8 Serialization format version v15. |
RegExpUnicodeSets | Enable writing RegExp with the UnicodeSets flag. |
ResizableArrayBuffers | Enable writing Resizable ArrayBuffers. |
first_v8_version | The V8 release that introduced this feature. |
Methods
Name | Description |
---|---|
supported_by | Get the optional serialization features supported by a V8 version or newer. |
SymbolicVersion
SymbolicVersion()
Attributes
Name | Description |
---|---|
Unreleased | A value greater than all Version instances. |