FA-5071 / Descriptor lookup / Open access
Special method type lookup: Bases truth on a shadowed instance __len__ · case 01
Bases truth on a shadowed instance __len__ and changes the required Python-language result.
ROOT CAUSE
Bases truth on a shadowed instance __len__. The executable reproducer isolates this operation from the rest of the contract.
THE FAILURE
Bases truth on a shadowed instance __len__. The executable reproducer isolates this operation from the rest of the contract.
Unsuccessful approach: The alternative still fails because it treats every allocated object as true regardless of its zero native length.
Case contract
A per-instance __len__ shadows direct attribute calls but does not change implicit len or truth testing. Return the selected native result; declared is an integer from 0 through sys.maxsize, and shadow is any nonnegative integer. 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(declared, shadow, operation):
class C:
def __len__(self): return declared
obj=C()
obj.__len__=lambda: shadow
if operation=='builtin': return len(obj)
if operation=='direct': return obj.__len__()
if operation=='class': return C.__len__(obj)
return bool(obj.__len__())
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('implicit ignores shadow', solve(2, 9, 'builtin'), 2)
check('direct sees shadow', solve(2, 9, 'direct'), 9)
check('class explicit sees declared', solve(2, 9, 'class'), 2)
check('zero native length false', solve(0, 9, 'truth'), False)
check('positive native length true', solve(2, 0, 'truth'), True)
check('zero shadow direct', solve(2, 0, 'direct'), 0)
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 |
|---|---|---|---|
| implicit ignores shadow | 2 | 2 | Passed |
| direct sees shadow | 9 | 9 | Passed |
| class explicit sees declared | 2 | 2 | Passed |
| zero native length false | True | False | Failed |
| positive native length true | False | True | Failed |
| zero shadow direct | 0 | 0 | Passed |
SHA-256 / 4babfa6779e233ec1ec0c2b29e62316d040ec4ffbd368e6bad73ad1f440160b6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(declared, shadow, operation):
class C:
def __len__(self): return declared
obj=C()
obj.__len__=lambda: shadow
if operation=='builtin': return len(obj)
if operation=='direct': return obj.__len__()
if operation=='class': return C.__len__(obj)
return obj is not None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('implicit ignores shadow', solve(2, 9, 'builtin'), 2)
check('direct sees shadow', solve(2, 9, 'direct'), 9)
check('class explicit sees declared', solve(2, 9, 'class'), 2)
check('zero native length false', solve(0, 9, 'truth'), False)
check('positive native length true', solve(2, 0, 'truth'), True)
check('zero shadow direct', solve(2, 0, 'direct'), 0)
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 |
|---|---|---|---|
| implicit ignores shadow | 2 | 2 | Passed |
| direct sees shadow | 9 | 9 | Passed |
| class explicit sees declared | 2 | 2 | Passed |
| zero native length false | True | False | Failed |
| positive native length true | True | True | Passed |
| zero shadow direct | 0 | 0 | Passed |
SHA-256 / 4fac0e51c9dd1fd69b9ff3f220749dcf2d907f53ee38635feeb2de1ce619b293
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:45.857161+00:00.
Case digest / 2c7f6dea469f2f4c6844432071f1098e2188bcd9814211e3bc99e009d329992a