Skip to content
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

bpo-38979: fix ContextVar "__class_getitem__" method #17497

Merged
merged 7 commits into from Dec 8, 2019

Conversation

@amiremohamadi
Copy link
Contributor

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

This comment has been minimized.

Copy link
@isidentical

isidentical Dec 7, 2019

Contributor

IMHO there is no need for examples for this fix

@isidentical

This comment has been minimized.

Copy link
Contributor

isidentical commented Dec 7, 2019

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 =

This comment has been minimized.

Copy link
@isidentical

isidentical Dec 7, 2019

Contributor

You might want to use double backtick for __class_getitem__

This comment has been minimized.

Copy link
@asvetlov

asvetlov Dec 7, 2019

Contributor

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 =

This comment has been minimized.

Copy link
@asvetlov

asvetlov Dec 7, 2019

Contributor

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

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 7, 2019

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

amiremohamadi commented Dec 7, 2019

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

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 7, 2019

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 Dec 7, 2019
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Dec 8, 2019

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

@miss-islington miss-islington merged commit 28c9163 into python:master Dec 8, 2019
4 checks passed
4 checks passed
Azure Pipelines PR #20191208.5 succeeded
Details
bedevere/issue-number Issue number 38979 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Dec 8, 2019

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

miss-islington added 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 <31338382+amiremohamadi@users.noreply.github.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 8, 2019

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

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 8, 2019

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

miss-islington added 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 <31338382+amiremohamadi@users.noreply.github.com>
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 <31338382+amiremohamadi@users.noreply.github.com>
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Dec 8, 2019

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

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 8, 2019

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

miss-islington added 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 <31338382+amiremohamadi@users.noreply.github.com>
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 <31338382+amiremohamadi@users.noreply.github.com>
sthagen added a commit to sthagen/cpython that referenced this pull request Dec 8, 2019
bpo-38979: fix ContextVar "__class_getitem__" method (pythonGH-17497)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.