-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
I'm in progress updating the Microsoft language server's copy of the typeshed repo in preparation for 3.8, and some type annotations we had been testing have broken on moving up to the latest master of typeshed (microsoft/python-language-server#1654).
Specifically #3191 removed some quotations around forward references, which broke some testing we had done to verify handling of Path's division overloads.
As far as I can tell from PEP 484, forward references should be using strings for types rather than actually referencing them (https://www.python.org/dev/peps/pep-0484/#forward-references), and our type system needs this assumption to be able to evaluate things correctly. In our case, replacing:
_P = TypeVar('_P', bound=PurePath)with:
_P = TypeVar('_P', bound='PurePath')Means we can process the stub, and this seems more reasonable from the point of "executing" the stub (if stubs could be run as-is), since PurePath has not yet been defined.
Should these forward references have been unquoted? Or has there been some change to the spec that isn't documented in the PEP?