-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use string type annotations for Python 3.11 not 3.10 (#420)
Use string type annotations for Python 3.11 not 3.10, as PEP 563 has been postponed to Python 3.11 https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/ Additionally: - add a CI entry testing cloudpickle against Python 3.10 (which was currently done in the python-nightly entry of the cloudpickle CI) - make the python-nightly entry test cloudpickle against Python 3.11, but make this entry temporarily optional because of the current instability of Python 3.11 (see the the #420 thread for additional details on this topic)
- Loading branch information
1 parent
6e0f571
commit eddd327
Showing
2 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/ | ||
assert ( | ||
obj.method.__annotations__["arg"] | ||
== expected_type_str | ||
|