Skip to content

stubgen: Do not remove Generic from base classes#15316

Merged
hauntsaninja merged 1 commit into
python:masterfrom
hamdanal:stubgen-generic-semanal
May 27, 2023
Merged

stubgen: Do not remove Generic from base classes#15316
hauntsaninja merged 1 commit into
python:masterfrom
hamdanal:stubgen-generic-semanal

Conversation

@hamdanal

Copy link
Copy Markdown
Collaborator

Consider this python code:

from typing import Generic, TypeVar

T = TypeVar("T")

class C(Generic[T]): ...

This is what stubgen produced before:

from typing import TypeVar

T = TypeVar('T')

class C: ...

and this after:

from typing import Generic, TypeVar

T = TypeVar('T')

class C(Generic[T]): ...

Note that stubgen handles generics correctly in --parse-only mode already.

Consider this python code:
```python
from typing import Generic, TypeVar

T = TypeVar("T")

class C(Generic[T]): ...
```

This is what stubgen produced before:
```python
from typing import TypeVar

T = TypeVar('T')

class C: ...
```

and this after:
```python
from typing import Generic, TypeVar

T = TypeVar('T')

class C(Generic[T]): ...
```

Note that stubgen handles generics correctly in --parse-only mode already.

@hauntsaninja hauntsaninja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hauntsaninja
hauntsaninja merged commit 7fe1fdd into python:master May 27, 2023
@hamdanal
hamdanal deleted the stubgen-generic-semanal branch May 27, 2023 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants