FA-5211 / Exception flow / Open access
Exception handler hierarchy: Places Exception before all specific error handlers · case 01
Places Exception before all specific error handlers and changes the required Python-language result.
ROOT CAUSE
Places Exception before all specific error handlers. The executable reproducer isolates this operation from the rest of the contract.
THE FAILURE
Places Exception before all specific error handlers. The executable reproducer isolates this operation from the rest of the contract.
Unsuccessful approach: The alternative still fails because it catches TypeError in the slot intended for KeyError.
Case contract
Dispatch KeyError, IndexError, other LookupError, other Exception, and BaseException separately. Handler order must preserve the specific subclass cases; SystemExit belongs outside Exception. 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(kind):
try:
kinds={'key':KeyError,'index':IndexError,'lookup':LookupError,'value':ValueError,'system':SystemExit}
if kind in kinds: raise kinds[kind]('failure')
return 'normal'
except Exception: return 'other'
except KeyError: return 'key'
except IndexError: return 'index'
except LookupError: return 'lookup'
except BaseException: return 'base'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapping failure', solve('key'), 'key')
check('sequence failure', solve('index'), 'index')
check('generic lookup failure', solve('lookup'), 'lookup')
check('ordinary other error', solve('value'), 'other')
check('termination is not Exception', solve('system'), 'base')
check('normal path', solve('none'), 'normal')
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| mapping failure | other | key | Failed |
| sequence failure | other | index | Failed |
| generic lookup failure | other | lookup | Failed |
| ordinary other error | other | other | Passed |
| termination is not Exception | base | base | Passed |
| normal path | normal | normal | Passed |
SHA-256 / ccaeecc2a8e7affc3e9a7e160313f0bb68a449e1d0d484b5a5d1a2421c438eaa
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(kind):
try:
kinds={'key':KeyError,'index':IndexError,'lookup':LookupError,'value':ValueError,'system':SystemExit}
if kind in kinds: raise kinds[kind]('failure')
return 'normal'
except TypeError: return 'key'
except IndexError: return 'index'
except LookupError: return 'lookup'
except Exception: return 'other'
except BaseException: return 'base'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapping failure', solve('key'), 'key')
check('sequence failure', solve('index'), 'index')
check('generic lookup failure', solve('lookup'), 'lookup')
check('ordinary other error', solve('value'), 'other')
check('termination is not Exception', solve('system'), 'base')
check('normal path', solve('none'), 'normal')
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| mapping failure | lookup | key | Failed |
| sequence failure | index | index | Passed |
| generic lookup failure | lookup | lookup | Passed |
| ordinary other error | other | other | Passed |
| termination is not Exception | base | base | Passed |
| normal path | normal | normal | Passed |
SHA-256 / 2d13c1fad589da064fce2e0a611d08a79498f26d8ba6db81d7bc1b6f2d36e66c
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 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:47.266069+00:00.
Case digest / d6c1e8fd1afcdf9c7eb0680de3591239fd1d7716bce821cd6bef2833a915f2ff