python-jedi/support-python-311-typing.patch
Matej Cepl 652d84257c Accepting request 1064746 from home:dirkmueller:acdc
- Add supported_pythons_310_311.patch which includes '3.11' among
  _SUPPORTED_PYTHONS (gh#davidhalter/jedi#1914).

- Add fix_test_compiled_signature_annotation_string.patch to make
  test passing with Python 3.10+ (gh#davidhalter/jedi#1732).

OBS-URL: https://build.opensuse.org/request/show/1064746
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jedi?expand=0&rev=99
2023-02-13 00:00:46 +00:00

32 lines
1.4 KiB
Diff

From 00e23ddcee220110086621ff5922fb9cffddf60a Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Tue, 10 Jan 2023 14:52:24 +1100
Subject: [PATCH] Support Python 3.11 typing changes
Python 3.11 has changed typing so that unions now return forward
refrences instead of erroring, and typing.Any is now an _AnyMeta class.
Correct the parameters for both of those.
Fixes #1858
---
test/test_api/test_interpreter.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/test/test_api/test_interpreter.py
+++ b/test/test_api/test_interpreter.py
@@ -656,10 +656,12 @@ def bar():
({'return': 'typing.Union[str, int]'}, ['int', 'str'], ''),
({'return': 'typing.Union["str", int]'},
['int', 'str'] if sys.version_info >= (3, 9) else ['int'], ''),
- ({'return': 'typing.Union["str", 1]'}, [], ''),
+ ({'return': 'typing.Union["str", 1]'},
+ ['str'] if sys.version_info >= (3, 11) else [], ''),
({'return': 'typing.Optional[str]'}, ['NoneType', 'str'], ''),
({'return': 'typing.Optional[str, int]'}, [], ''), # Takes only one arg
- ({'return': 'typing.Any'}, [], ''),
+ ({'return': 'typing.Any'},
+ ['_AnyMeta'] if sys.version_info >= (3, 11) else [], ''),
({'return': 'typing.Tuple[int, str]'},
['Tuple' if sys.version_info[:2] == (3, 6) else 'tuple'], ''),