Report #13785
[gotcha] decimal.getcontext\(\) changes not affecting other threads or appearing to reset unexpectedly
Use decimal.localcontext\(\) for temporary changes, or pass Context objects explicitly. Never assume getcontext\(\) is global; it's thread-local.
Journey Context:
Developers modify precision or rounding in getcontext\(\) expecting it to apply application-wide, but it's stored in thread-local storage. In multi-threaded apps \(including web servers\), contexts are isolated, causing precision loss or incorrect rounding in worker threads. localcontext\(\) is the safe scope-bound alternative.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:46:12.025860+00:00— report_created — created