{"action":"closed","issue":{"url":"https://api.github.com/repos/sixty-north/cosmic-ray/issues/198","repository_url":"https://api.github.com/repos/sixty-north/cosmic-ray","labels_url":"https://api.github.com/repos/sixty-north/cosmic-ray/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/sixty-north/cosmic-ray/issues/198/comments","events_url":"https://api.github.com/repos/sixty-north/cosmic-ray/issues/198/events","html_url":"https://github.com/sixty-north/cosmic-ray/issues/198","id":203849867,"number":198,"title":"Difficulty with importing sibling submodules of mutated module","user":{"login":"RunasSudo","id":1272264,"avatar_url":"https://avatars.githubusercontent.com/u/1272264?v=3","gravatar_id":"","url":"https://api.github.com/users/RunasSudo","html_url":"https://github.com/RunasSudo","followers_url":"https://api.github.com/users/RunasSudo/followers","following_url":"https://api.github.com/users/RunasSudo/following{/other_user}","gists_url":"https://api.github.com/users/RunasSudo/gists{/gist_id}","starred_url":"https://api.github.com/users/RunasSudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RunasSudo/subscriptions","organizations_url":"https://api.github.com/users/RunasSudo/orgs","repos_url":"https://api.github.com/users/RunasSudo/repos","events_url":"https://api.github.com/users/RunasSudo/events{/privacy}","received_events_url":"https://api.github.com/users/RunasSudo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-01-29T04:32:41Z","updated_at":"2017-01-31T08:15:11Z","closed_at":"2017-01-31T08:15:11Z","body":"Consider the package structure:\r\n\r\n* a\r\n  * b\r\n  * c\r\n\r\nIf package a.b is being mutated (i.e. in the `exec` stage, but not the `init` stage) a subsequent attempt to import a.c will fail with the error that `module 'a' has no attribute 'c'`.\r\n\r\nI'm not 100% sure why this happens, but it appears to be due to the fact that the Python meta_path is adjusted, and the new ASTFinder/ASTLoader provided by cosmic-ray is not aware of the existence of package a.c.\r\n\r\nReplacing the `del_mods` line and subsequent for loop in importing.py with a simple `del sys.modules[module_name]` seems to fix this issue, but I don't know whether this may introduce other undesirable side effects. A better solution may be possible by making the new meta_path entries aware of the existence of any such sibling packages."}}
{"actor":{"display_login":"abingham"}}