State the output lifetime contract

All three answers from the reused-buffer function are correct when they return. After later calls, only one of the three retained outputs still matches its expected answer. This original nine-call CPU example separates an immediate value check from a promise that earlier outputs will stay valid.[3][4]

The task contract is deliberately specific: return a newly owned flat integer list containing twice the input values, and leave earlier returned lists unchanged through later calls unless the caller writes to them. The harness never writes to a returned list. An API that explicitly returns a reusable buffer or a short-lived view has a different legitimate contract; this example does not condemn that design.[3][4]

Three ordered input pairs have independently written answers: [1, 2] requires [2, 4]; [4, -1] requires [8, -2]; and [0, 3] requires [0, 6]. The inputs and expected answers become immutable tuples before execution. We run three authored functions once per pair, with a fresh function instance for each sequence. All nine calls are retained.[3][4]

Inspect the retained result

The fresh-correct function returns a new list on every call. The reused-buffer function writes the correct values into one instance list and returns that same list each time. Its first immediate snapshot is [2, 4]. After the second call, the first retained reference reads [8, -2]. After the third call, all three retained references read [0, 6]. Only the third expected answer matches that final value.[3][4]

The saved record includes the input, literal expected answer, immediate snapshot, object-identity comparisons and every retained-output snapshot before and after each call. Python is comparisons show that all three reused-buffer returns refer to the same list. The fresh functions return distinct lists. These are trusted Python observations, not claims about tensor storage, GPU memory or adversarial execution.[3][4]

  • Inspect retained values: The reused list passes 3 / 3 immediate checks; after the sequence only 1 / 3 retained references matches.

All nine authored calls. The lifetime column covers only the two outputs exposed to later calls in each sequence.

Authored functionCorrect at returnCorrect at endEarlier outputs unchanged
Fresh correct3 / 33 / 32 / 2
Reused buffer3 / 31 / 30 / 2
Fresh wrong0 / 30 / 32 / 2
  • Literal expected answers are [2, 4], [8, -2] and [0, 6].
  • Final-return lifetime is unexercised and recorded null. Newly owned stable outputs are the declared contract; reusable-buffer APIs may specify another.

Separate values, stability and adapters

The fresh-wrong control returns [3, 5], [9, -1] and [1, 7]. Its outputs remain separate and stable, but all three are numerically wrong. Stability is therefore a separate requirement from correct values. Passing one does not establish the other.[3][4]

Two earlier outputs in each sequence are exposed to later calls. Both stay unchanged for fresh-correct and fresh-wrong; neither stays unchanged for reused-buffer. The final return has no later call in this fixture. Its lifetime result is recorded as null, not counted as evidence of stability.[3][4]

A separately labeled adapter saves a tuple of each returned flat-integer value immediately. Those three snapshots preserve the reused-buffer answers correctly. The adapter uses the same nine calls and adds no candidate execution. It changes the retention pipeline; it does not show that the candidate meets the original stable-output contract. Copy work is unmeasured, and a shallow copy of nested mutable objects would need a separate analysis.[3][4]

  • Separate an adapter: Immediate flat-integer snapshots preserve the answers, but copying does not repair the original candidate contract.

Preserve scope and credit

Python documentation supplies the background: assignment binds names to objects, while copying creates a separate container; the language reference defines identity and mutable lists. Nodus authored the functions, fixture, harness and worked example. No upstream implementation was copied.[1][2][3]

The program ran once on CPython 3.9.6 on 2026-11-24 UTC. Fourteen selected fixture checks passed. The MIT package contains the exact executed source, portable protocol, fixture and complete result. Packaging and artwork read those saved bytes without running the functions again.[3][4][5]

For an output that will be retained by a grader or data pipeline, state its ownership and lifetime contract before choosing the check. Preserve an immediate value observation, retain the object as the intended consumer would, and inspect it after selected later calls. Keep adapter behavior separate. This finite example distinguishes the three authored functions; it does not establish universal correctness, a real benchmark defect, a failure rate or a training gain.[3][4]

  • Keep output ownership, lifetime and adapter behavior with the complete correctness record.

Sources

  1. Python documentation: copy — Shallow and deep copy operations — Python Software Foundation docs.python.org
  2. Python language reference: Objects, values and types — Python Software Foundation docs.python.org
  3. MIT proof and complete saved output data.nodus-compute.ai
  4. Saved result JSON data.nodus-compute.ai
  5. Source and saved-result provenance data.nodus-compute.ai
  6. Vector figure data.nodus-compute.ai