|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -import typing_extensions |
6 | 5 | from abc import abstractmethod
|
7 | 6 | from typing import Callable, Final
|
8 | 7 |
|
@@ -542,29 +541,10 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value:
|
542 | 541 | # HAX: Mypy internally represents TypedDict classes differently from what
|
543 | 542 | # should happen at runtime. Replace with something that works.
|
544 | 543 | module = "typing"
|
545 |
| - if builder.options.capi_version < (3, 9): |
546 |
| - name = "TypedDict" |
547 |
| - if builder.options.capi_version < (3, 8): |
548 |
| - # TypedDict was added to typing in Python 3.8. |
549 |
| - module = "typing_extensions" |
550 |
| - # TypedDict is not a real type on typing_extensions 4.7.0+ |
551 |
| - name = "_TypedDict" |
552 |
| - if isinstance(typing_extensions.TypedDict, type): |
553 |
| - raise RuntimeError( |
554 |
| - "It looks like you may have an old version " |
555 |
| - "of typing_extensions installed. " |
556 |
| - "typing_extensions>=4.7.0 is required on Python 3.7." |
557 |
| - ) |
558 |
| - else: |
559 |
| - # In Python 3.9 TypedDict is not a real type. |
560 |
| - name = "_TypedDict" |
| 544 | + name = "_TypedDict" |
561 | 545 | base = builder.get_module_attr(module, name, cdef.line)
|
562 | 546 | elif is_named_tuple and cls.fullname == "builtins.tuple":
|
563 |
| - if builder.options.capi_version < (3, 9): |
564 |
| - name = "NamedTuple" |
565 |
| - else: |
566 |
| - # This was changed in Python 3.9. |
567 |
| - name = "_NamedTuple" |
| 547 | + name = "_NamedTuple" |
568 | 548 | base = builder.get_module_attr("typing", name, cdef.line)
|
569 | 549 | else:
|
570 | 550 | cls_module = cls.fullname.rsplit(".", 1)[0]
|
|
0 commit comments