FAILURE MAP
← Case archive

FA-4651 / Iterator consumption / Open access

Iterator second pass is exhausted · case 01

The operation returns a result or retained state that violates this contract: Materializing a one-pass iterator exhausts it; a second materialization is empty.

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

ROOT CAUSE

The second pass constructs a fresh iterator instead of reusing the exhausted cursor.

VERIFIED REPAIR

Materializing a one-pass iterator exhausts it; a second materialization is empty.

Unsuccessful approach: Returning the first materialization again fabricates a second traversal.

Case contract

Materializing a one-pass iterator exhausts it; a second materialization is empty. 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):
    return [list(x),list(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two values', solve(['a', 'b']), [['a', 'b'], []])
check('singleton', solve(['a']), [['a'], []])
check('empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [['a', 'a'], []])
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
two values[['a', 'b'], ['a', 'b']][['a', 'b'], []]Failed
singleton[['a'], ['a']][['a'], []]Failed
empty[[], []][[], []]Passed
duplicates[['a', 'a'], ['a', 'a']][['a', 'a'], []]Failed

SHA-256 / e3dd2cd179aba948fd51a93b93650074e2e15c16404a8bfef5b8b76d93ed0cd1

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):
    g=iter(x); a=list(g); return [a,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two values', solve(['a', 'b']), [['a', 'b'], []])
check('singleton', solve(['a']), [['a'], []])
check('empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [['a', 'a'], []])
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
two values[['a', 'b'], ['a', 'b']][['a', 'b'], []]Failed
singleton[['a'], ['a']][['a'], []]Failed
empty[[], []][[], []]Passed
duplicates[['a', 'a'], ['a', 'a']][['a', 'a'], []]Failed

SHA-256 / dd179f402ddde9c628159e86a9d99d970d09529faadd096839ffc3080e8db851

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):
    g=iter(x); a=list(g); return [a,list(g)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two values', solve(['a', 'b']), [['a', 'b'], []])
check('singleton', solve(['a']), [['a'], []])
check('empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [['a', 'a'], []])
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
two values[['a', 'b'], []][['a', 'b'], []]Passed
singleton[['a'], []][['a'], []]Passed
empty[[], []][[], []]Passed
duplicates[['a', 'a'], []][['a', 'a'], []]Passed

SHA-256 / e78889562d24f5bc79bdb3d598b9a984230da2ca38f46135599d915ea3dd949a

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

Case digest / 6dde0d65623c0ca3c5b4e64ba0fe32e76534fd9f2d59d2119b718be11ce91b81