Skip to content

typing: Gst: Update stubs to 1.28.2#292

Merged
bryanforbes merged 1 commit intopygobject:masterfrom
xclaesse:gst-1.28
Apr 15, 2026
Merged

typing: Gst: Update stubs to 1.28.2#292
bryanforbes merged 1 commit intopygobject:masterfrom
xclaesse:gst-1.28

Conversation

@xclaesse
Copy link
Copy Markdown
Contributor

No description provided.

@xclaesse
Copy link
Copy Markdown
Contributor Author

Those stubs are generated in an Ubuntu 26.04 docker which now has everything needed for GStreamer.

@xclaesse
Copy link
Copy Markdown
Contributor Author

@bryanforbes GStreamer overrides have class Iterator(GObject.GBoxed, typing.Generic[T]):. But it seems stubs are not importing typing module anymore.

@bryanforbes
Copy link
Copy Markdown
Collaborator

But it seems stubs are not importing typing module anymore.

The generator uses import tracking now, so symbols are imported directly. The issue is that for objects that have GObject introspection information, the bases aren't looked at. I'll work on modifying the generator to inspect that.

@bryanforbes
Copy link
Copy Markdown
Collaborator

The overrides should be using collection.abc.Iterator since typing.Iterator has been deprecated since 3.9. It would also be good if the overrides used typing_extensions.TypeVar so the generic can have a default (T = TypeVar('T', default=Any)).

@bryanforbes
Copy link
Copy Markdown
Collaborator

I have a solution that I worked up today to build the base class list for the stubs based on the MRO. I need to run a few more tests in the morning, but it’s far more robust and retains the classes set up by overrides, including Generic and its type arguments.

@bryanforbes
Copy link
Copy Markdown
Collaborator

I merged my solution and the other gstreamer PR that generates from 1.26. You'll want to rebase on master and regenerate the gstreamer stubs.

@xclaesse
Copy link
Copy Markdown
Contributor Author

Thanks! Stubs regenerated and seems good now.

BTW, I noticed another possible regression (not related to gst), for boxed types we generate:

    @staticmethod
    def __new__(cls: type[Self]) -> Self: ...

But pylance complains: "Self" is not valid in this context. It seems it's not allowed to use Self with staticmethod. Technically new is not a classmethod.

@bryanforbes
Copy link
Copy Markdown
Collaborator

BTW, I noticed another possible regression (not related to gst), for boxed types we generate:

That's on my list of things to address. There are definitely places where PyGObject are incorrectly using Self, but I think the generator is adding those to other methods as well.

@bryanforbes bryanforbes merged commit 91a72ee into pygobject:master Apr 15, 2026
2 checks passed
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