Skip to content

Conversation

amiremohamadi
Copy link
Contributor

@amiremohamadi amiremohamadi commented Dec 7, 2019

now contextvars.ContextVar "class_getitem" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov

@@ -0,0 +1,3 @@
return class from __class_getitem__ to simplify subclassing. E.g. `clss =
contextvars.ContextVar[str]` returned `None` instead of `<class
Copy link
Member

Choose a reason for hiding this comment

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

IMHO there is no need for examples for this fix

@isidentical
Copy link
Member

def test_context_var_new_2(self):
self.assertIsNone(contextvars.ContextVar[int])

You need to remove this test

@@ -0,0 +1,3 @@
return class from __class_getitem__ to simplify subclassing. E.g. `clss =
Copy link
Member

Choose a reason for hiding this comment

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

You might want to use double backtick for __class_getitem__

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with both @isidentical comments. @amiremohamadi please address them.
Otherwise, the PR looks awesome.

@@ -0,0 +1,3 @@
return class from __class_getitem__ to simplify subclassing. E.g. `clss =
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with both @isidentical comments. @amiremohamadi please address them.
Otherwise, the PR looks awesome.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@asvetlov
Copy link
Contributor

asvetlov commented Dec 7, 2019

Since __class_getitem__ was here starting from Python 3.7 I think that the backport of the fix makes sense.

It cannot break any code.

@amiremohamadi
Copy link
Contributor Author

@asvetlov, @isidentical thanks for your help! :)
I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from asvetlov December 7, 2019 16:44
@miss-islington
Copy link
Contributor

@amiremohamadi: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 28c9163 into python:master Dec 8, 2019
@miss-islington
Copy link
Contributor

Thanks @amiremohamadi for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 8, 2019
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c9163)

Co-authored-by: AMIR <[email protected]>
@bedevere-bot
Copy link

GH-17505 is a backport of this pull request to the 3.8 branch.

@bedevere-bot
Copy link

GH-17506 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 8, 2019
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c9163)

Co-authored-by: AMIR <[email protected]>
miss-islington added a commit that referenced this pull request Dec 8, 2019
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c9163)

Co-authored-by: AMIR <[email protected]>
@miss-islington
Copy link
Contributor

Thanks @amiremohamadi for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-17507 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 8, 2019
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c9163)

Co-authored-by: AMIR <[email protected]>
miss-islington added a commit that referenced this pull request Dec 8, 2019
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c9163)

Co-authored-by: AMIR <[email protected]>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. 


https://bugs.python.org/issue38979



Automerge-Triggered-By: @asvetlov
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.

6 participants