Skip to content

Commit bfc6d48

Browse files
committed
bindgen: Fix typing imports on Python < 3.11
NotRequired, ParamSpec and TypedDict come from typing_extensions there.
1 parent 903143c commit bfc6d48

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

frida/frida_bindgen/codegen.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ def read_asset(name: str) -> str:
3434
return (ASSETS_DIR / name).read_text(encoding="utf-8")
3535

3636

37-
FACADE_TYPING_IMPORTS = (
38-
"from typing import (Any, Callable, Dict, List, Literal, Mapping, NotRequired, Optional, Tuple, TypedDict, "
39-
"Sequence, Union, ParamSpec, TypeVar, cast, overload)"
40-
)
37+
FACADE_TYPING_IMPORTS = """\
38+
from typing import (Any, Callable, Dict, List, Literal, Mapping, Optional, Tuple, Sequence, Union, TypeVar, cast,
39+
overload)
40+
41+
if sys.version_info >= (3, 11):
42+
from typing import NotRequired, ParamSpec, TypedDict
43+
else:
44+
from typing_extensions import NotRequired, ParamSpec, TypedDict"""
4145

4246

4347
def generate_facade_preludes(model: Model) -> List[str]:

0 commit comments

Comments
 (0)