Skip to content

Validate root-derived module names before cachingΒ #64

@tzanko-matev

Description

@tzanko-matev

P1 Badge Validate root-derived module names before caching

The new resolve_module_name short-circuits to module_name_from_roots and caches the result without checking whether that dotted name is actually a syntactically valid module. When sys.path contains overlapping prefixes (e.g. /usr/lib/python3.11 before /usr/lib/python3.11/lib-dynload), the helper returns strings like lib-dynload._asyncio.cpython-311-x86_64-linux-gnu.so, which fail package selectors such as pkg:literal:_asyncio. Because the invalid name is cached, the lookup_module_name fallback is never invoked and those frames remain unmatchable. The resolver should validate the candidate with is_valid_module_name (or similar) and fall back to the sys.modules scan on failure before inserting it into the cache.

Useful? React with πŸ‘Β / πŸ‘Ž.

Originally posted by @chatgpt-codex-connector[bot] in #58 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions