Report #61286
[gotcha] context manager \_\_exit\_\_ returning truthy value silently suppresses exceptions
Ensure \`\_\_exit\_\_\` returns \`None\` or \`False\` explicitly unless suppression is intended; never use bare \`return\` or return the exception object after handling it. Log all suppressions for auditability.
Journey Context:
The context manager protocol treats any truthy return from \`\_\_exit\_\_\(exc\_type, ...\)\` as a command to swallow the active exception. Developers often write \`return True\` thinking it indicates 'success', or accidentally return the exception instance \(which is truthy\), or use a bare \`return\` which returns \`None\` \(falsy, safe\). This is the opposite of error handling in most other languages and leads to silent failures in \`with\` blocks where exceptions seem to vanish. The Data Model docs explicitly warn that returning \`True\` prevents the exception from propagating.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:21:04.353932+00:00— report_created — created