FAILURE MAP
← Case archive

FA-5006 / Descriptor lookup / Open access

Getattr fallback: Invokes __getattr__ before trying actual attribute lookup · case 01

Invokes __getattr__ before trying actual attribute lookup and changes the required Python-language result.

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

ROOT CAUSE

Invokes __getattr__ before trying actual attribute lookup. The executable reproducer isolates this operation from the rest of the contract.

VERIFIED REPAIR

Read attributes normally: instance attributes override plain class values; __getattr__ supplies missing:name only after AttributeError, including AttributeError from a property getter.

Unsuccessful approach: The alternative still fails because it calls object.__getattribute__ directly and bypasses __getattr__ fallback.

Case contract

Read attributes normally: instance attributes override plain class values; __getattr__ supplies missing:name only after AttributeError, including AttributeError from a property getter. 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(values, names):
    class C:
        present='class-value'
        @property
        def trouble(self):
            raise AttributeError('getter failed')
        def __getattr__(self,name):
            return 'missing:'+name
    c=C(); c.__dict__.update(values)
    out=[]
    for name in names:
        try: out.append(c.__getattr__(name))
        except Exception as exc: out.append(type(exc).__name__)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing class and missing', solve({}, ['present', 'other']), ['class-value', 'missing:other'])
check('instance override', solve({'present': 0}, ['present']), [0])
check('property AttributeError falls back', solve({}, ['trouble']), ['missing:trouble'])
check('stored None is present', solve({'other': None}, ['other', 'absent']), [None, 'missing:absent'])
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
existing class and missing['missing:present', 'missing:other']['class-value', 'missing:other']Failed
instance override['missing:present'][0]Failed
property AttributeError falls back['missing:trouble']['missing:trouble']Passed
stored None is present['missing:other', 'missing:absent'][None, 'missing:absent']Failed

SHA-256 / 00009c98d9de4e7ddac58e3cfa0cbeb20021f3e3d14d40cc8a7e990494501b58

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(values, names):
    class C:
        present='class-value'
        @property
        def trouble(self):
            raise AttributeError('getter failed')
        def __getattr__(self,name):
            return 'missing:'+name
    c=C(); c.__dict__.update(values)
    out=[]
    for name in names:
        try: out.append(object.__getattribute__(c,name))
        except Exception as exc: out.append(type(exc).__name__)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing class and missing', solve({}, ['present', 'other']), ['class-value', 'missing:other'])
check('instance override', solve({'present': 0}, ['present']), [0])
check('property AttributeError falls back', solve({}, ['trouble']), ['missing:trouble'])
check('stored None is present', solve({'other': None}, ['other', 'absent']), [None, 'missing:absent'])
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
existing class and missing['class-value', 'AttributeError']['class-value', 'missing:other']Failed
instance override[0][0]Passed
property AttributeError falls back['AttributeError']['missing:trouble']Failed
stored None is present[None, 'AttributeError'][None, 'missing:absent']Failed

SHA-256 / 02267a5c112d5a23a2d53753858141abe36f09a8992ef3f45aee425fd558c610

3 / The verified repair

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

N = 1
observations = []
def solve(values, names):
    class C:
        present='class-value'
        @property
        def trouble(self):
            raise AttributeError('getter failed')
        def __getattr__(self,name):
            return 'missing:'+name
    c=C(); c.__dict__.update(values)
    out=[]
    for name in names:
        try: out.append(getattr(c,name))
        except Exception as exc: out.append(type(exc).__name__)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing class and missing', solve({}, ['present', 'other']), ['class-value', 'missing:other'])
check('instance override', solve({'present': 0}, ['present']), [0])
check('property AttributeError falls back', solve({}, ['trouble']), ['missing:trouble'])
check('stored None is present', solve({'other': None}, ['other', 'absent']), [None, 'missing:absent'])
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
existing class and missing['class-value', 'missing:other']['class-value', 'missing:other']Passed
instance override[0][0]Passed
property AttributeError falls back['missing:trouble']['missing:trouble']Passed
stored None is present[None, 'missing:absent'][None, 'missing:absent']Passed

SHA-256 / daf8bbfad47d494e507e263e1c2c755301ceb7f00533587abcc6861b0942c8a2

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.181035+00:00.

Case digest / 191cb809ce7e347566f5b636f53774cecdbb9cec5d9951b4c4db999c14cab0d6