Skip to content

Resolve on_class targets from __qualname__ - #267

Closed
dima179-fuse wants to merge 3 commits into
simplistix:mainfrom
dima179-fuse:cursor/dima179-faster-on-class-be7e
Closed

dima179-fuse wants to merge 3 commits into
simplistix:mainfrom
dima179-fuse:cursor/dima179-faster-on-class-be7e

Conversation

@dima179-fuse

Copy link
Copy Markdown

get_referrers walks every live object, so replacing one method in a large test process took hundreds of milliseconds. A class reachable from its module is named by qualname, so resolve that class directly and keep the heap scan for classes defined inside functions.

Accessor = Callable[[Any, str], Any]


def _class_from_qualname(attribute: Any, name: str | None) -> type | None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverage is missing, see CI failures, but also I wonder how much of this can be handed off to resolve instead.

@dima179-fuse
dima179-fuse marked this pull request as ready for review September 23, 2026 14:29
get_referrers walks every live object, so replacing one method in a
large test process took hundreds of milliseconds. A class reachable
from its module is named by __qualname__, so resolve that class
directly and keep the heap scan for classes defined inside functions.

Co-authored-by: Dmitry Voronetskiy <dima179-fuse@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/dima179-faster-on-class-be7e branch from 62b191f to 916fdb7 Compare September 23, 2026 14:29
cursoragent and others added 2 commits September 29, 2026 13:19
Cover a module dropped from sys.modules, a class name rebound to an
instance, and a class left behind by a module reload, instead of
calling the private helper with mocks.

Co-authored-by: Dmitry Voronetskiy <dima179-fuse@users.noreply.github.com>
Co-authored-by: Dmitry Voronetskiy <dima179-fuse@users.noreply.github.com>
@cjw296 cjw296 mentioned this pull request Oct 2, 2026
@cjw296 cjw296 closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants