You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use tp_getattro for AttributeError suggestions instead of the __getattr__ hook (#126)
* Use tp_getattro instead of the miss-only __getattr__ hook
Reimplement the AttributeError member-name suggestions on top of a
ClassObject.tp_getattro override, replacing the miss-only __getattr__
hook (AttributeErrorHint) that was merged in #124.
The hook installed a shared __getattr__ on every reflected type and
manually rewired tp_getattro to CPython's slot_tp_getattr_hook. That
surgery is significantly more invasive for no measurable real-world
benefit: the per-access cost it avoids (~17 ns) is lost in the noise on
realistic Lean workloads. This version keeps the enrichment entirely in
a tp_getattro override that delegates to PyObject_GenericGetAttr and only
does work on a miss, and drops all the slot manipulation.
Behaviour and messages are unchanged (snake_case "Did you mean ...?"
suggestions); the existing Python and embedding tests are untouched and
still pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Bump version to 2.0.56
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments