Skip to content

Raise an error if .root() is not a module #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pylint-bot opened this issue Jun 20, 2015 · 3 comments · Fixed by #2744
Closed

Raise an error if .root() is not a module #120

pylint-bot opened this issue Jun 20, 2015 · 3 comments · Fixed by #2744
Labels
Milestone

Comments

@pylint-bot
Copy link

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore)


.root() should guarantee that what it returns is a module. Unfortunately, I found a couple of cases, which involved transforms, where .root() return classes instead of modules. We should raise an error in that case (and probably we should fix whatever was returning a class to return a module instead).


@pylint-bot
Copy link
Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Actually this can happen if the tree was spliced from another and it is in the course of being transformed.

@temyurchenko
Copy link
Contributor

Why is this completed? ".root" sometimes returns not a module. In particular, for some nodes made with const_factory

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented May 13, 2025

#2672 gave an example of root not being a module but Unknown instead.

a=eval.__get__(1).__gt__

@a
class c: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants