Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mypy-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml
typing_extensions>=4.1.0
typing_extensions>=4.1.0; python_version >= '3.8'
typing_extensions>=4.7.0; python_version < '3.8'
mypy_extensions>=1.0.0
typed_ast>=1.4.0,<2; python_version<'3.8'
tomli>=1.1.0; python_version<'3.11'
10 changes: 8 additions & 2 deletions mypyc/irbuild/classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import typing_extensions
from abc import abstractmethod
from typing import Callable
from typing_extensions import Final
Expand Down Expand Up @@ -498,9 +499,14 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value:
if builder.options.capi_version < (3, 8):
# TypedDict was added to typing in Python 3.8.
module = "typing_extensions"
# It needs to be "_TypedDict" on typing_extensions 4.7.0+
# and "TypedDict" otherwise.
# TypedDict is not a real type on typing_extensions 4.7.0+
name = "_TypedDict"
if isinstance(typing_extensions.TypedDict, type):
raise RuntimeError(
"It looks like you may have an old version "
"of typing_extensions installed. "
"typing_extensions>=4.7.0 is required on Python 3.7."
)
else:
# In Python 3.9 TypedDict is not a real type.
name = "_TypedDict"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ requires = [
"setuptools >= 40.6.2",
"wheel >= 0.30.0",
# the following is from mypy-requirements.txt
"typing_extensions>=4.1.0",
"typing_extensions>=4.1.0; python_version >= '3.8'",
"typing_extensions>=4.7.0; python_version < '3.8'",
"mypy_extensions>=1.0.0",
"typed_ast>=1.4.0,<2; python_version<'3.8'",
"tomli>=1.1.0; python_version<'3.11'",
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def run(self):
# When changing this, also update mypy-requirements.txt.
install_requires=[
"typed_ast >= 1.4.0, < 2; python_version<'3.8'",
"typing_extensions>=4.1.0",
"typing_extensions>=4.1.0; python_version >= '3.8'",
"typing_extensions>=4.7.0; python_version < '3.8'",
"mypy_extensions >= 1.0.0",
"tomli>=1.1.0; python_version<'3.11'",
],
Expand Down