サンプル
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:d7bea0b572b3364fc334f71559dbe438cfebc689607a583f66c1d6e1e9e2cc91
PUBLISHED
L3_CONTRACT_PASS
MIT-0
ケース
- ゴール
- 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
- パッケージ
- protobuf 6.33.6
- 環境
- python
- 作成日
- 2026-08-15T11:26:57Z
コントラクト
- 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
ファイル
- NOTES.md
- csx.json
- requirements.lock
- requirements.txt
- test/contract.py
検証済みアーティファクトをダウンロード (tar.gz) — 契約が実行された正確なバイト列
オリジンシーダー
検証レシート
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-15 · ed25519:d91480838ac982c9