Skip to content

Conversation

@matusvalo
Copy link
Contributor

Fixes #7246

@matusvalo
Copy link
Contributor Author

The PR is not handling following case:

a: int = 5
a: int
a = 6

@matusvalo
Copy link
Contributor Author

This PR will break users which redeclare variable with same type.

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

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

It's good to see that some tests needed changing. Worth discussing the implications and assumptions here.

Comment on lines -22 to 24

var = 1 # type: annotation
pyobj_var = 1 # type: annotation
var: cython.int = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was probably intentional as well at the time.

Comment on lines -9 to 11
def main():
foo1: typing.Tuple = None
foo0: typing.Tuple = None
foo1: typing.Bar = None
Copy link
Contributor

Choose a reason for hiding this comment

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

This test assumption seems wrong and should never have been allowed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Handle properly redeclaration of variable in pure python mode

2 participants