FAILURE MAP
← Case archive

FA-4586 / Iterator consumption / Open access

Repeat retains object identity · case 01

The operation returns a result or retained state that violates this contract: Repeat one mutable list n times, mutate its first repeated reference, and report all repetitions; they alias the same object.

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

ROOT CAUSE

Constructing a fresh list per repetition changes aliasing semantics.

VERIFIED REPAIR

Repeat one mutable list n times, mutate its first repeated reference, and report all repetitions; they alias the same object.

Unsuccessful approach: Independent unmodified copies omit both shared identity and the required mutation.

Case contract

Repeat one mutable list n times, mutate its first repeated reference, and report all repetitions; they alias the same object. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    r=[list(x) for _ in range(y)]
    if r: r[0].append("new")
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated alias', solve(['a'], 2), [['a', 'new'], ['a', 'new']])
check('single alias', solve([], 1), [['new']])
check('zero repeats', solve(['a'], 0), [])
check('three aliases', solve([], 3), [['new'], ['new'], ['new']])
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
repeated alias[['a', 'new'], ['a']][['a', 'new'], ['a', 'new']]Failed
single alias[['new']][['new']]Passed
zero repeats[][]Passed
three aliases[['new'], [], []][['new'], ['new'], ['new']]Failed

SHA-256 / b558a3606edf06899e11d99c7e0a4f3a8c1d06358dd7e0a8997793492b6474ab

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    r=[list(x) for _ in range(y)]
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated alias', solve(['a'], 2), [['a', 'new'], ['a', 'new']])
check('single alias', solve([], 1), [['new']])
check('zero repeats', solve(['a'], 0), [])
check('three aliases', solve([], 3), [['new'], ['new'], ['new']])
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
repeated alias[['a'], ['a']][['a', 'new'], ['a', 'new']]Failed
single alias[[]][['new']]Failed
zero repeats[][]Passed
three aliases[[], [], []][['new'], ['new'], ['new']]Failed

SHA-256 / 6fe4d8e24294a23218d5baf1bfdf26e103a49f6d6159177869c4e16937a21414

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    a=list(x); r=list(it.repeat(a,y))
    if r: r[0].append("new")
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated alias', solve(['a'], 2), [['a', 'new'], ['a', 'new']])
check('single alias', solve([], 1), [['new']])
check('zero repeats', solve(['a'], 0), [])
check('three aliases', solve([], 3), [['new'], ['new'], ['new']])
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
repeated alias[['a', 'new'], ['a', 'new']][['a', 'new'], ['a', 'new']]Passed
single alias[['new']][['new']]Passed
zero repeats[][]Passed
three aliases[['new'], ['new'], ['new']][['new'], ['new'], ['new']]Passed

SHA-256 / 3833b485906ed148baff4e63b4c00b3d5453ba17c6a5d2879667fc67f2957707

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

Case digest / c1ac6d49441aa1ad82468795b0b0b1f3e95520b98eca8acc5786b1fe2d484baf