-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
add typing.ContextManager for 3.6+ only #1200
Conversation
This fixes the easier part of python#655. Would it make sense to add a generic typing.ContextManager that exists in any Python version?
[Ahem, let me try that again.]
Maybe, but it'll take a long time until everyone has it (esp. Python 3.5 users). I do think there's some room for improvement, esp. since the stdlib name is apparently AbstractContextManager. But let's merge this PR without waiting for that. |
Don't merge yet, there may be a problem with this and our internal codebase. |
Ironically the issues I am seeing are due to Python 2 code importing ContextLib (inside |
Sorry, I'm still waiting for a resolution on our end. This affects a fair amount of code. |
If it's easier to move things forward, I'd be happy to keep I imagine it's going to be helpful for use cases like yours if |
OK, let's close this and keep typing.ContextManager in all versions, per python/typing#422. |
We'll still need some changes here since currently there is no ContextManager in typing.pyi. I'll reopen this and make the appropriate changes once the typing PR is resolved. |
Oh wait, you're right. This PR removes it from contextlib. We may still want that but first we want to add it to typing, so I can switch our usages to the latter. FWIW the usages seem to be of the form
|
This fixes the easier part of #655.
Would it make sense to add a generic typing.ContextManager that exists in any Python version?