-
-
Notifications
You must be signed in to change notification settings - Fork 117
TypeError when running example recipe under "Runtime use of types" in the documentation #531
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
Comments
We made a change in recent versions of Python to allow invalid types inside However, this isn't essential to the example. We should just change the example to something like |
Some background info: Since Python 3.8 In Python 3.11 the restrictions (checked by I guess the documentation was run with 3.11+ :) |
Hi @JelleZijlstra and @Daraan, Thank you for getting back to me so quickly. I'm installing typing_extensions as it is a requirement for SQLalchemy and I ran this example test script to verify that typing_extensions was installed on my environment correctly. Is it fair to assume that by changing 42 to int and getting false back, typing_extensions is working correctly? Also, with regards to fixing this error, what would the fix be? Does the documentation need to be updated to say int? My biggest concern is, given that I can't upgrade my current version of Python for other unrelated reasons, I'm afraid that there might be functional impacts to SQLalchemy. Thanks, |
Your installation is fine; it's just a mistake in our documentation. |
This fails at runtime in older versions, and in any case it is an invalid type. Fixes #531
This fails at runtime in older versions, and in any case it is an invalid type. Fixes #531
Hello,
I believe I have found a potential issue in either typing-extensions or the documentation for typing-extensions when running the example recipe code under "Runtime use of types" in the documentation. Link to documentation: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types
Im have created the following script to test out typing-extensions on my wsl environment.
However, when i run this code (after using pip to install typing-extensions 4.12.2 and using python version 3.8.10), I get the following error:
Out of interest, I ran the same test file on clean Python docker images (with the latest tag which had Python 3.13.2 and an older image that had Python 3.9.21, i also manually installed typing-extensions on both docker containers using pip install typing-extensions). The image that had Python 3.13.2 installed did not show any issues and print False as expected. However, the docker image that had Python 3.9.21 installed on it also showed the same TypeError. Out of interest, I replaced typing_extensions.Final with typing.Final the same error was seen.
Also, if I replaced the 42 with the word int and the TypeError was not seen.
I don't suppose this is a typo in the documentation or are there specific versions of Python 3.8 and 3.9 that don't work with typing-extensions 4.12.2?
Any help or advice would be appreciated.
Thanks,
The text was updated successfully, but these errors were encountered: