Skip to content

Implement PEP-560: core support for generic types #2753

@verailina

Description

@verailina

Seems that Generic.__class_getitem__ can't be called automatically after cythonization.

Code sample example.py:

from typing import Generic, TypeVar

T = TypeVar("T")
print(Generic[T])

Cythonization:
cythonize -a -i example.py

The cythonized code fails with TypeError:

>>> import example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "example.py", line 5, in init example
    print(Generic[T])
TypeError: 'type' object is not subscriptable

Cython 0.29.1
Python 3.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions