CodeSampleX

Beispiel

protobuf 6.33.6: 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

Verifiziertes Beispiel für pypi protobuf 6.33.6: Know which protobuf backend actually loaded: upb ships inside the binary wheel, so a musl/Alpine image with…

sha256:d7bea0b572b3364fc334f71559dbe438cfebc689607a583f66c1d6e1e9e2cc91

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
2
Deklarierte Umgebung python linux x64 python python pip

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-15
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

Fall

HOW
Ziel
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
Pakete
Symbole
  • google.protobuf.internal.api_implementation.Type
  • google.protobuf.descriptor.Descriptor
Umgebung
python
Erstellt
2026-08-15T11:26:57Z

Contract

  1. 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
  2. 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
  3. assert PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python forces the pure-Python backend
  4. assert PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp keeps Type()=='cpp' with no _c_module and then fails loudly on import, rather than falling back
  5. assert an unsupported backend name raises ValueError naming the supported ones
  6. assert backend selection is cached at first import, so mutating the environment afterwards changes nothing

Dateien

  • NOTES.md
  • csx.json
  • requirements.lock
  • requirements.txt
  • test/contract.py

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

anonymous