Ejemplo
Know which protobuf backend actually loaded: upb ships inside the binary wheel, so a musl/Alpine image with no prebuilt wheel silently gets the pure-Python fallback with different descriptor types and no warning
sha256:c9584f100b9c7d02e58cafd357cb7675633c331806f8861d6584f6fe4d6a0a57
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Know which protobuf backend actually loaded: upb ships inside the binary wheel, so a musl/Alpine image with no prebuilt wheel silently gets the pure-Python fallback with different descriptor types and no warning HOW
- Paquetes
- protobuf 6.33.6
- Entorno
- python
- Creado
- 2026-08-17T02:16:59Z
Contrato
- assert the default backend is whatever the platform's wheel provided: upb when the C extension is importable, python when it is not, with no warning either way
- assert the pure-Python fallback carries different descriptor classes (google.protobuf.descriptor rather than google._upb._message), so isinstance and __module__ checks written against upb stop matching
- assert PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python forces the pure-Python backend
- assert PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp keeps Type()=='cpp' with no _c_module and then fails loudly on import, rather than falling back
- assert an unsupported backend name raises ValueError naming the supported ones
- assert backend selection is cached at first import, so mutating the environment afterwards changes nothing
Archivos
- NOTES.md
- csx.json
- requirements.lock
- requirements.txt
- test/contract.py
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-17 · ed25519:d91480838ac982c9