FA-5061 / Descriptor lookup / Open access
Special method type lookup: Bypasses the instance shadow for an explicit __len__ call · case 01
Bypasses the instance shadow for an explicit __len__ call and changes the required Python-language result.
ROOT CAUSE
Bypasses the instance shadow for an explicit __len__ call. The executable reproducer isolates this operation from the rest of the contract.
VERIFIED REPAIR
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.
Unsuccessful approach: The alternative still fails because it uses the instance override for an explicit class method invocation.
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 C.__len__(obj)
if operation=='class': return C.__len__(obj)
return bool(obj)
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 | 2 | 9 | Failed |
| class explicit sees declared | 2 | 2 | Passed |
| zero native length false | False | False | Passed |
| positive native length true | True | True | Passed |
| zero shadow direct | 2 | 0 | Failed |
SHA-256 / 9906f478106ae22d65b731a2a8ebea255b6e48092b30bcd41f16560e31c1e0bc
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 obj.__len__()
return bool(obj)
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 | 9 | 2 | Failed |
| zero native length false | False | False | Passed |
| positive native length true | True | True | Passed |
| zero shadow direct | 0 | 0 | Passed |
SHA-256 / ab20839fd246573bce950b5308886889e6d7edf7c47332aaa6fb9f288633f8f1
3 / The verified repair
Exit 0"""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)
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 | False | False | Passed |
| positive native length true | True | True | Passed |
| zero shadow direct | 0 | 0 | Passed |
SHA-256 / a74ebdffc72f8ea8cbc50318adb0514f88f5314a1629dc175b55ea6dea6f20ba
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.809604+00:00.
Case digest / d704c099bd97cef9e188d03997c19ef5f8a24da17010a3f1e21502240c8b6b1a