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)
The new
resolve_module_nameshort-circuits tomodule_name_from_rootsand caches the result without checking whether that dotted name is actually a syntactically valid module. Whensys.pathcontains overlapping prefixes (e.g./usr/lib/python3.11before/usr/lib/python3.11/lib-dynload), the helper returns strings likelib-dynload._asyncio.cpython-311-x86_64-linux-gnu.so, which fail package selectors such aspkg:literal:_asyncio. Because the invalid name is cached, thelookup_module_namefallback is never invoked and those frames remain unmatchable. The resolver should validate the candidate withis_valid_module_name(or similar) and fall back to thesys.modulesscan on failure before inserting it into the cache.Useful? React with 👍 / 👎.
Originally posted by @chatgpt-codex-connector[bot] in #58 (comment)