Skip to content

Regression since v0.520 due to PR #3700: Name 'blah' not defined #3713

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
gvanrossum opened this issue Jul 13, 2017 · 0 comments
Closed

Regression since v0.520 due to PR #3700: Name 'blah' not defined #3713

gvanrossum opened this issue Jul 13, 2017 · 0 comments
Assignees

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Jul 13, 2017

Example:

class A(object):
    def f(self):
        self.attr = 1
    attr = 0  # error: Name 'attr' is not defined

class B(object):
    attr = 0  # no error
    def f(self):
        self.attr = 1

This has no errors in v0.520 but has an error at the indicated line at f127e2c, i.e. it is caused by #3700.

@gvanrossum gvanrossum changed the title Regression since v0.520 due to PR #3700 Regression since v0.520 due to PR #3700: Name 'blah' not defined Jul 13, 2017
gvanrossum pushed a commit that referenced this issue Jul 17, 2017
Fixes #3713

The idea is just to not show an error when accessing in the class body an attribute defined on ``self`` (mypy does not distinguishes them anyway). As well, the correct node is returned on lookup, previously this resulted in some spurious ``Any`` types.

(In addition I enable two previously skipped test, just noticed them when added tests for this PR.)
gvanrossum pushed a commit that referenced this issue Jul 18, 2017
Fixes #3713

The idea is just to not show an error when accessing in the class body an attribute defined on ``self`` (mypy does not distinguishes them anyway). As well, the correct node is returned on lookup, previously this resulted in some spurious ``Any`` types.

(In addition I enable two previously skipped test, just noticed them when added tests for this PR.)
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

2 participants