Skip to content

Fix GenericAlias parameter chaining #3394

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

Merged
merged 4 commits into from
Nov 2, 2021

Conversation

Snowapril
Copy link
Contributor

This revision fix some misworking functions

  • Fix original make_parameters & subs_tvars
  • test_parameters and test_parameter_chaining tests now going success

I removed extra_tests/snippets/test_typing.py which I added in #3374, that I had been thought there are no tests for
using TypeVar with GenericAlias. It is actually covered by test_parameter_chaining in test_genericalias.py

@moreal Could you review this commit? As you originally added this commit, I'd be a pleasure if you review this one 😊
In cpython, only they push parameters if they are not already exist. I fixed that mismatch between rustpython.

@Snowapril Snowapril force-pushed the fix-ga-param-chaining branch from c27691e to c18febe Compare October 31, 2021 11:01
make_parameters must not push duplicated parameters
as cpython implementation.

See `tuple_add` function of `genericaliasobject.c` in cpython code
https://github.com/python/cpython/blob/main/Objects/genericaliasobject.c#L191

Signed-off-by: snowapril <sinjihng@gmail.com>
Signed-off-by: snowapril <sinjihng@gmail.com>
Signed-off-by: snowapril <sinjihng@gmail.com>
As this extra_test already covered by `test_parameter_chaining` in
`test_genericalias.py`, remove duplicated test

Signed-off-by: snowapril <sinjihng@gmail.com>
@Snowapril Snowapril force-pushed the fix-ga-param-chaining branch from c18febe to f6c2999 Compare October 31, 2021 11:02
Copy link
Contributor

@moreal moreal left a comment

Choose a reason for hiding this comment

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

👍🏻 🔨

@DimitrisJim DimitrisJim merged commit 612e943 into RustPython:main Nov 2, 2021
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.

4 participants