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
fix: iter_markers/get_closest_marker now correctly returns closest MRO marker
Fix get_closest_marker and iter_markers to return markers in correct
closest-first order when class inheritance (MRO) is involved (#14329).
Previously, own_markers on Class nodes stored MRO-inherited markers in
base-first (farthest) order, and iter_markers yielded them in that same
order. This caused get_closest_marker to return a base class marker
instead of the overriding child class marker.
The fix introduces _iter_own_markers_closest_first() on Node, overridden
by Class to walk the MRO in natural closest-first order while preserving
decorator stacking order within each class. This avoids changing
own_markers (keeping its base-first construction order) and avoids
breaking parametrize naming order.
Also reverses usefixtures marker iteration to maintain farthest-first
setup ordering (module -> base class -> child class -> function).
Alternative structural approach to PR #14332 that preserves own_markers
order for backward compatibility.
Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude Opus 4.6 <claude@anthropic.com>
0 commit comments