Exemplo
Configure orjson option bitmasks to intercept subclasses, dataclasses, naive timestamps, and JS-safe integers that default serialization silently bypasses or corrupts
sha256:05f2672095e6b40251604acdb3f1cf2defa139aa701bc9f92f5d48baa62b229e
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Configure orjson option bitmasks to intercept subclasses, dataclasses, naive timestamps, and JS-safe integers that default serialization silently bypasses or corrupts HOW
- Pacotes
- orjson 3.12.0
- Ambiente
- python
- Criado
- 2026-08-16T07:09:11Z
Contrato
- assert primitive subclasses bypass the default hook and serialize raw unless OPT_PASSTHROUGH_SUBCLASS is set
- assert dataclasses bypass the default hook and serialize all fields natively unless OPT_PASSTHROUGH_DATACLASS is set
- assert datetime objects bypass the default hook unless OPT_PASSTHROUGH_DATETIME is set
- assert OPT_UTC_Z alone has no effect on naive datetimes, requiring OPT_NAIVE_UTC composed via bitwise OR to emit Zulu format
- assert integers within 53-bit range serialize under OPT_STRICT_INTEGER while integers exceeding 2**53-1 raise TypeError
- assert orjson.Fragment splices raw buffers zero-copy and raises TypeError during dumps if the content is not bytes or str
- assert dumps parameter is singular 'option' raising TypeError on 'options', and invalid bitmasks raise TypeError
- assert OPT_APPEND_NEWLINE writes a trailing newline and composed options execute simultaneously in a single dumps pass
Arquivos
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/config.py
- test/contract.py
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-16 · ed25519:d91480838ac982c9