CodeSampleX

Beispiel

Configuring abandon_on_cancel=False on anyio.to_thread.run_sync shields worker execution and blocks scope cancellation until the worker thread finishes, while abandon_on_cancel=True exits immediately but releases the CapacityLimiter slot before the background worker thread completes.

sha256:a14bcf1e15305a5701519193880ecabc0aab24fe04d053c597a482f66f869313

PUBLISHED L3_CONTRACT_PASS MIT-0

Ausführungsbelege

Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.

BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS

Deklarierte Umgebung

Ausführungskontext
python
Betriebssystem
linux
Architektur
x64
Runtime
python
Sprache
python
Paketmanager
pip

Umgebungen der Verifizierungsläufe

Ausführungskontext
python 3.12
Betriebssystem
linux alpine · musl
Architektur
x64
Runtime
python 3.12
Sprache
python
Paketmanager
pip
Ausführung
container · docker

CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-17

Fall

Ziel
Configuring abandon_on_cancel=False on anyio.to_thread.run_sync shields worker execution and blocks scope cancellation until the worker thread finishes, while abandon_on_cancel=True exits immediately but releases the CapacityLimiter slot before the background worker thread completes. HOW
Pakete
anyio 4.13.0
Umgebung
python
Erstellt
2026-08-17T11:44:01Z

Häufige Annahme

Cancelling a task waiting on anyio.to_thread.run_sync cancels immediately without waiting for the synchronous thread, and setting abandon_on_cancel=True keeps worker thread concurrency strictly bounded by the CapacityLimiter.

So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.

Contract

Dateien

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

csx-seed

Verifizierungsbelege