Skip to content

Instantiating a Generic class returns None #806

Open
@markusand

Description

@markusand

When trying to instantiate a simple Generic class, it returns None. Removing the (Generic[T]) part returns the proper instance.

from typing import Generic, TypeVar

T = TypeVar('T')

class TestClass(Generic[T]):
    _attr: T
    
    def __init__(self, attr: T):
        self._attr = attr


test = TestClass(34)
print(test)  # None

I'm using micropython 3.4.0; MicroPython v1.25.0-preview.365.g3823aeb0f.dirty on 2025-03-10.
Don't know how to get typing version, but should definitely be more than 1.24.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions