Implement descriptors with suspension and dump support

Merged
JA
8d ago
+3580-421

Implement descriptors for sandbox classes, including property, classmethod, staticmethod, and attribute deletion. A shared resolver applies data-descriptor precedence for reads, calls, getattr, hasattr, class patterns, and synchronous dataclass reads. Builtin wrappers use a typed descriptor enum. Attribute reads that the fast path cannot prove direct run inside frozen continuations, preserving defaults and pattern results across forwarding and suspension.

Descriptor hooks execute through ordinary VM frames and can suspend on host or OS calls, then resume after dump/restore. Class creation calls __set_name__ in namespace order. Internal implementation calls have a separate 1,024-frame cap per task, preserved across suspension and restore, so descriptor call cycles raise RecursionError without reducing the Python call-depth budget. Missing property accessor errors include the property name and owner, deletion tracebacks retain carets, and bound methods expose __func__ and __self__.

Rebased onto current main. DUMP_VERSION remains 15, preserving main's existing format and supported older fixtures. This branch does not depend on #1089 or #1264; MRO lookup and subclass cache invalidation belong to the inheritance integration.

Validation:

  • 1,079 Rust tests passed with cargo test -p monty --features ref-count-return.
  • All 748 Monty fixture cases passed.
  • 135 descriptor/REPL/dump tests passed with memory-model-checks; descriptor fixtures passed on Monty and CPython with memory-model-checks,ref-count-return.
  • Workspace Clippy checks, import checks, Rust formatting, Ruff, basedpyright, stubtest, and changed Markdown formatting passed.
  • The full CPython 3.14.2 fixture run passed 736 cases and failed 12 fixtures that are unchanged from main; the descriptor cases passed.