PEP 649 `__annotate__` #1214
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 441 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.364
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1214"
general
weight: 0.35
samuelcolvin
<!-- This is an auto-generated description by cubic. -->
Summary by cubic
Implements PEP 649 lazy annotations, replacing stringized annotation storage with compiled
__annotate__(format)functions evaluated on access, reported as__annotate__in tracebacks whatever a class body binds them as, matching CPython 3.14.f.__annotations__/__annotate__recompute per access; a class's annotations dict is cached on first read.typinggeneric forms (List[int],ClassVar[int],Callable[[int], str], …) are now subscriptable, buildingGenericAliasvalues with CPython's repr and argument checks;Callable[[a, b], r]stores(a, b, r)soget_type_hintsresolves forward references inside the list. Non-dunder attribute calls on an alias route to the origin's own lookup, reaching host classes; an unknown attribute raises with the bare name for any special-form origin (ClassVar,Final,Literal,Annotated), and with thecollections.abcclass name for the ABC-based forms.get_annotations/get_type_hintsimplement theannotationlibVALUE/FORWARDREF/STRING format fallbacks and stripAnnotatedunlessinclude_extras; FORWARDREF raisesNameErrorinstead of asking the host, and a class is cached only on that success. A non-dict FORWARDREF/STRING result raises CPython'sValueError, whileT.__annotations__keeps theTypeError.get_type_hintstreatsLiteralaliases as leaves, so their string values aren't resolved as forward references.Literaldeduplicates and flattens its values by type and hash, comparing and hashing them as a set.typingsubscripts andC.__annotations__preflight their argument and namespace copies (a flattenedAnnotatedas one combined buffer, the fresh annotations dict guarded across its cache insertion), so a large one raisesMemoryErrorinstead of hitting the allocator's hard ceiling.getattr()/hasattr()run__annotations__synchronously, so an annotation'sAttributeErroryields the default orFalse;C.__annotations__ = dreplaces one the namespace bound.dataclassesreads evaluated annotations at decoration;Field.typeholds the value instead of annotation text.from __future__ import annotations, annotation dicts hold strings as before, now covered byclass__annotations_future.py.<sup>Written for commit 5e19abb8f2efd1555678622635e0b418a9d09b01. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/pydantic/monty/pull/1214?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/pydantic/monty/1214?returnTo=https%3A%2F%2Fgithub.com%2Fpydantic%2Fmonty%2Fpull%2F1214&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->