FAILURE MAP
← Case archive

FA-5151 / Context managers / Open access

Context exception suppression: Suppresses exceptions when the policy is disabled instead of enabled · case 01

Suppresses exceptions when the policy is disabled instead of enabled and changes the required Python-language result.

Verified by executionVariant 1 · 5 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Suppresses exceptions when the policy is disabled instead of enabled. The executable reproducer isolates this operation from the rest of the contract.

THE FAILURE

Suppresses exceptions when the policy is disabled instead of enabled. The executable reproducer isolates this operation from the rest of the contract.

Unsuccessful approach: The alternative still fails because it suppresses unrelated exception types whenever suppression is enabled.

Case contract

A context manager suppresses only ValueError when enabled. __exit__ observes the actual exception class or None on normal exit; unsuppressed exceptions reach the outer handler and skip after. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

Why this case matters

Runs Python standard-library language operations in a deterministic local reproducer. Literal expected answers are authored independently. Related defects share an evaluation group to avoid benchmark split leakage.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(error, enabled):
    log=[]
    class Manager:
        def __enter__(self):
            log.append('enter')
            return self
        def __exit__(self, typ, exc, tb):
            log.append('exit:'+('none' if typ is None else typ.__name__))
            return typ is ValueError and not enabled
    try:
        with Manager():
            log.append('body')
            if error=='value': raise ValueError('value')
            if error=='key': raise KeyError('key')
            if error=='type': raise TypeError('type')
        log.append('after')
    except Exception as exc:
        log.append('caught:'+type(exc).__name__)
    return log
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('normal exit', solve('none', True), ['enter', 'body', 'exit:none', 'after'])
check('selected error suppressed', solve('value', True), ['enter', 'body', 'exit:ValueError', 'after'])
check('disabled propagation', solve('value', False), ['enter', 'body', 'exit:ValueError', 'caught:ValueError'])
check('unrelated error propagates', solve('key', True), ['enter', 'body', 'exit:KeyError', 'caught:KeyError'])
check('other unrelated type', solve('type', True), ['enter', 'body', 'exit:TypeError', 'caught:TypeError'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
normal exit['enter', 'body', 'exit:none', 'after']['enter', 'body', 'exit:none', 'after']Passed
selected error suppressed['enter', 'body', 'exit:ValueError', 'caught:ValueError']['enter', 'body', 'exit:ValueError', 'after']Failed
disabled propagation['enter', 'body', 'exit:ValueError', 'after']['enter', 'body', 'exit:ValueError', 'caught:ValueError']Failed
unrelated error propagates['enter', 'body', 'exit:KeyError', 'caught:KeyError']['enter', 'body', 'exit:KeyError', 'caught:KeyError']Passed
other unrelated type['enter', 'body', 'exit:TypeError', 'caught:TypeError']['enter', 'body', 'exit:TypeError', 'caught:TypeError']Passed

SHA-256 / 12c9235da6aa4ebdc6ea9516d120d2c948679041f0bc81161f53c91fca588a6f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(error, enabled):
    log=[]
    class Manager:
        def __enter__(self):
            log.append('enter')
            return self
        def __exit__(self, typ, exc, tb):
            log.append('exit:'+('none' if typ is None else typ.__name__))
            return enabled
    try:
        with Manager():
            log.append('body')
            if error=='value': raise ValueError('value')
            if error=='key': raise KeyError('key')
            if error=='type': raise TypeError('type')
        log.append('after')
    except Exception as exc:
        log.append('caught:'+type(exc).__name__)
    return log
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('normal exit', solve('none', True), ['enter', 'body', 'exit:none', 'after'])
check('selected error suppressed', solve('value', True), ['enter', 'body', 'exit:ValueError', 'after'])
check('disabled propagation', solve('value', False), ['enter', 'body', 'exit:ValueError', 'caught:ValueError'])
check('unrelated error propagates', solve('key', True), ['enter', 'body', 'exit:KeyError', 'caught:KeyError'])
check('other unrelated type', solve('type', True), ['enter', 'body', 'exit:TypeError', 'caught:TypeError'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
normal exit['enter', 'body', 'exit:none', 'after']['enter', 'body', 'exit:none', 'after']Passed
selected error suppressed['enter', 'body', 'exit:ValueError', 'after']['enter', 'body', 'exit:ValueError', 'after']Passed
disabled propagation['enter', 'body', 'exit:ValueError', 'caught:ValueError']['enter', 'body', 'exit:ValueError', 'caught:ValueError']Passed
unrelated error propagates['enter', 'body', 'exit:KeyError', 'after']['enter', 'body', 'exit:KeyError', 'caught:KeyError']Failed
other unrelated type['enter', 'body', 'exit:TypeError', 'after']['enter', 'body', 'exit:TypeError', 'caught:TypeError']Failed

SHA-256 / ca759d22e014d4b4d746eecc2052b91a018ba56a5218a007e8159978234d24df

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 5 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:46.463704+00:00.

Case digest / b058e4e781e548b21ff2e66055212004616360efde49d19f0a7f5d149bbc556f