CodeSampleX

Sample

orjson 3.12.0: Configure orjson option bitmasks to intercept subclasses, dataclasses, naive timestamps, and JS-safe integers that default serialization silently bypasses or corrupts

Verified sample for pypi orjson 3.12.0: Configure orjson option bitmasks to intercept subclasses, dataclasses, naive timestamps, and JS-safe integers that…

sha256:05f2672095e6b40251604acdb3f1cf2defa139aa701bc9f92f5d48baa62b229e

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment python linux x64 python python pip

Verification-run environments

Environment Contract Stages Run
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-16
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Case

HOW
Goal
Configure orjson option bitmasks to intercept subclasses, dataclasses, naive timestamps, and JS-safe integers that default serialization silently bypasses or corrupts
Packages
Symbols
  • orjson.dumps
  • orjson.loads
  • orjson.Fragment
  • orjson.OPT_PASSTHROUGH_SUBCLASS
  • orjson.OPT_PASSTHROUGH_DATACLASS
  • orjson.OPT_PASSTHROUGH_DATETIME
  • orjson.OPT_STRICT_INTEGER
  • orjson.OPT_NAIVE_UTC
  • orjson.OPT_UTC_Z
  • orjson.OPT_APPEND_NEWLINE
Environment
python
Created
2026-08-16T07:09:11Z

Contract

  1. assert primitive subclasses bypass the default hook and serialize raw unless OPT_PASSTHROUGH_SUBCLASS is set
  2. assert dataclasses bypass the default hook and serialize all fields natively unless OPT_PASSTHROUGH_DATACLASS is set
  3. assert datetime objects bypass the default hook unless OPT_PASSTHROUGH_DATETIME is set
  4. assert OPT_UTC_Z alone has no effect on naive datetimes, requiring OPT_NAIVE_UTC composed via bitwise OR to emit Zulu format
  5. assert integers within 53-bit range serialize under OPT_STRICT_INTEGER while integers exceeding 2**53-1 raise TypeError
  6. assert orjson.Fragment splices raw buffers zero-copy and raises TypeError during dumps if the content is not bytes or str
  7. assert dumps parameter is singular 'option' raising TypeError on 'options', and invalid bitmasks raise TypeError
  8. assert OPT_APPEND_NEWLINE writes a trailing newline and composed options execute simultaneously in a single dumps pass

Files

  • NOTES.md
  • csx.json
  • requirements.txt
  • src/__init__.py
  • src/config.py
  • test/contract.py

Download the source artifact (tar.gz)

Origin Seeder

csx-seed