Skip to content

Original node wins in case of a redefinition (especially if it is a class)#5565

Merged
ilevkivskyi merged 5 commits into
python:masterfrom
ilevkivskyi:fix-over-crash
Sep 4, 2018
Merged

Original node wins in case of a redefinition (especially if it is a class)#5565
ilevkivskyi merged 5 commits into
python:masterfrom
ilevkivskyi:fix-over-crash

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Sep 3, 2018

Copy link
Copy Markdown
Member

Fixes #5534

In principle we can be even more strict (see a little exception for class scope) but then we need to work on python/typeshed#2423 first.

@ilevkivskyi
ilevkivskyi requested a review from JukkaL September 3, 2018 15:18
@JelleZijlstra

Copy link
Copy Markdown
Member

I submitted python/typeshed#2424 to fix the bad stub. Probably better to get that fix in first so mypy can be more consistent.

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one question about a test.

Comment thread mypy/semanal.py
name = node.name()
if name in self.locals[-1]:
self.name_already_defined(name, ctx, self.locals[-1][name])
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test case for this?

@ilevkivskyi ilevkivskyi mentioned this pull request Sep 4, 2018
@ilevkivskyi ilevkivskyi mentioned this pull request Sep 4, 2018
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 this pull request may close these issues.

3 participants