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

Module alias as instance attribute does not work #4291

Closed
JukkaL opened this issue Nov 29, 2017 · 1 comment · Fixed by #8259
Closed

Module alias as instance attribute does not work #4291

JukkaL opened this issue Nov 29, 2017 · 1 comment · Fixed by #8259

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 29, 2017

The error generated by the following program is unexpected:

import os

class C:
    def __init__(self) -> None:
        self.os = os
        self.os.chdir('/')  # Error: Module has no attribute "chdir"
        os.chdir('/')  # Ok

C()  # No runtime error
@ilevkivskyi
Copy link
Member

Looks like just an oversight in #3435, this

if not isinstance(lval, NameExpr):
    continue

could be probably just replaced with

if not isinstance(lval, RefExpr):
    continue

plus corresponding minor changes.

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

Successfully merging a pull request may close this issue.

2 participants