Skip to content
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

Better message when name not available due to --no-implicit-reexport #7251

Closed
JukkaL opened this issue Jul 22, 2019 · 6 comments
Closed

Better message when name not available due to --no-implicit-reexport #7251

JukkaL opened this issue Jul 22, 2019 · 6 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 22, 2019

Currently if an imported name is not available because of --no-implicit-reexport, mypy just says that it's undefined. This is confusing since it doesn't match runtime semantics. It would be better to say that the name is not an exported name. We could also explain how to mark a name as exported and maybe explain why this check is enabled.

#7247 is an example where this came up, but there have been other issues.

@samyak-jn
Copy link

Hey, @JukkaL I want to take that task for correcting it if no one is on it?
If yes, Can you please brief me with some follow-ups?

@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 8, 2019

Sure, nobody is working on this right now. I'll give some pointers tomorrow.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 11, 2019

@samyak-jn The relevant code is in mypy/semanal.py, in visit_import_from, around here:

            elif module and not missing_submodule:
                # Target module exists but the imported name is missing or hidden.
                self.report_missing_module_attribute(module_id, id, imported_id, imp)

The error message should be changed in this case to say that the name is not an exported name, and it would be nice to add a note explaining how to export a name (from <module> import name as name).

@hellocoldworld
Copy link
Contributor

Any updates on this?

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 3, 2020

No updates.

@hauntsaninja
Copy link
Collaborator

I believe #9237 should fix this

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

No branches or pull requests

4 participants