Fix in-place mutation for builtin containers

Merged
JA
1mo ago
+873-102

Fix augmented assignment on mutable builtin containers so aliases observe the update.
Previously, list/deque *= and set augmented operators could replace the container, and list += accepted only lists.

Native list/deque repetition through *= preserves identity, including for __index__ counts and bounded deques.
List += accepts synchronous iterables and retains items yielded before an iterator raises.
Set |=, &=, -=, and ^= mutate for set/frozenset operands, reuse cached hashes, and retain the receiver's identity.
Dict views continue to use reflected binary fallback and produce a replacement value.
Reflected user arithmetic runs before native sequence mutation.

User-defined __i*__ methods remain unsupported; this PR fixes builtin containers and their shared dispatch.
The bytearray PR #1208 builds on this change; memoryview follows in #1228.

Validation:

  • Full monty test suite with memory-model checks passed.
  • Focused parity, alias, callback, cyclic-GC, and iterator-invalidation tests passed with test hooks enabled.
  • The Python parity fixture passed under CPython.
  • Worker allocation regressions raise MemoryError and leave the session usable.
  • Rust formatting, Clippy with warnings denied, and Python lint checks passed.