Uh oh!
There was an error while loading. Please reload this page.
Add warnings.catch_warning type hints with Literal. - #3464
Conversation
This is a nice change, thanks. However, I wonder if there is a better way to fix the issue. This PR changes
Maybe @srittau knows how to keep it a class? Maybe it's possible to |
I agree that keeping it as a class would be preferable. From what I understand overloaded init method that allow to narrow the type of a typevar is something that is currently being worked on in mypy. So we can probably improve these hints soon. |
blueyed
commented
Nov 22, 2019
As pointed out already this fails now: importwarningsclassWarningsRecorder(warnings.catch_warnings):
passAre there plans to fix / allow this still? |
JelleZijlstra
commented
Nov 23, 2019
It looks like we should revert to an implementation that uses a class and overloads |
mslapek
commented
Nov 25, 2019
I've performed modification in #3499 to "eat the cake and have it too". @JelleZijlstra Thanks for tip with |
Fixes#3463