-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility with Python 3.11 (#467)
Code objects have some new attributes. Those are related to the enhanced exceptions with code highlighting. CI job for Python 3.11 is no longer optional.
- Loading branch information
1 parent
9a0013e
commit f758eb3
Showing
5 changed files
with
29 additions
and
68 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
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 |
---|---|---|
|
@@ -2386,29 +2386,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, 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 | ||
) | ||
assert ( | ||
obj.method.__annotations__["return"] | ||
== expected_type_str | ||
) | ||
else: | ||
assert ( | ||
obj.method.__annotations__["arg"] == expected_type | ||
) | ||
assert ( | ||
obj.method.__annotations__["return"] | ||
== expected_type | ||
) | ||
assert ( | ||
obj.method.__annotations__["arg"] == expected_type | ||
) | ||
assert ( | ||
obj.method.__annotations__["return"] | ||
== expected_type | ||
) | ||
return "ok" | ||
|
||
obj = MyClass() | ||
|
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