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

Use string type annotations for Python 3.11 not 3.10 #420

Merged
merged 7 commits into from Jun 19, 2021
7 changes: 5 additions & 2 deletions tests/cloudpickle_test.py
Expand Up @@ -2207,10 +2207,13 @@ def method(self, arg: type_) -> type_:

def check_annotations(obj, expected_type, expected_type_str):
assert obj.__annotations__["attribute"] == expected_type
if sys.version_info >= (3, 10):
# In Python 3.10, type annotations are stored as strings.
if sys.version_info >= (3, 11):
# In Python 3.11, type annotations are stored as strings.
# See PEP 563 for more details:
# https://www.python.org/dev/peps/pep-0563/
# Originaly scheduled for 3.10, then postponed.
# See this for more details:
# https://mail.python.org/archives/list/python-dev@python.org/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/
assert (
obj.method.__annotations__["arg"]
== expected_type_str
Expand Down