Both of the resolver's readers of a Python base list stopped early. pythonBases,
behind module-global and self. dispatch, read only the class line.
declaredSupertypes, behind class-name calls, read three lines and needed the
closing parenthesis on them. black and ruff wrap a long list one base per line,
so class Wrapped(Mixin, Base) written that way seemed to have no bases:
current = Wrapped() then current.run(), and Wrapped.run(x), reached nothing a
base declares. Extraction already read the whole list.
A new pythonBaseList reads from the class line to the list's closing
parenthesis, counting nested parentheses, within the class's extent, and leaves
out comments, so a ) in one doesn't end the list. Both readers use it.
declaredSupertypes still drops type arguments first, the composition the author
posted on PR #3001, and keeps its metaclass= and factory rewrites.
Validation:
- The test file: 7 of 9 fail without this change (the two one-line controls
pass), 9 pass here. Putting the type-argument drop out of the merged
case 'python' fails the new composition case and the two of PR #3083.
- Wrapped.run(None) on a wrapped base list reaches Base::run with the kernel
and with wasm, as do a list over five lines, a decorated class, and a wrapped
Base[Optional[User]].
- A/B on top of PR #2998, 7 Python repos, 459,440 edges: 118 added (102 calls,
16 references), 0 removed, 959 call sites moved, 113 kept their target with
higher confidence. requests, flask, litestar, mypy and django do not change.
polar: 942 XRepository.from_session(session) calls move from a sibling
repository's from_session at 0.65 to RepositoryBase.from_session at 0.85.
sqlalchemy: wrapped heads like class Table( and class ColumnElement( now
reach what they inherit: t.select() reaches FromClause.select. Its 17 moved
sites read right; 15 of them land on the typing-only SQLCoreOperations
overload of the same ColumnOperators method.
- Controls express and gin: full dumps byte-identical.
- No kernel change. Index cost with PR #2998, sqlalchemy, median of 3
interleaved: 23.7 s on main, 25.2 s here.
Original PR #3001 by @JosefAschauer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>