Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubgen: Do not remove Generic from base classes #15316

Merged
merged 1 commit into from
May 27, 2023

Conversation

hamdanal
Copy link
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.
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

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