Skip to content

Serialization is broken. #174

@python-processing-unit

Description

@python-processing-unit

According to the specification section 4.7.2:

When a THR is used in a boolean context, a completed or stopped THR MUST be treated as FALSE, and any other state MUST be treated as TRUE.

In the implementation, UNSER unconditionally forces finished = true on all deserialized THR values, causing paused threads to evaluate as falsey when they should be truthy. Additionally, SER encodes "stop" using the finished flag when it should reflect a separate "stop requested" state. This causes serialization and deserialization round-trips to lose thread lifecycle information.

Separately, UNSER accepts malformed serialized forms without raising errors: missing "v" in BOOL, zero-dimension TNS shapes, mismatched shape/data length in TNS, and tensor keys in MAP all silently succeed instead of raising runtime errors as the spec requires.

Metadata

Metadata

Labels

bugSomething isn't workinginterpreterRequires a code change in the interpreter.patchRequires a patch version change.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions