Skip to content

Type of user_data is None throughout the stubs #149

@cebtenzzre

Description

@cebtenzzre

user_data is obviously meant for the programmer to put arbitrary data in for later use. At runtime it may be any type. However, user_data is typed as None throughout these stubs.

Here is an example:

import gi

gi.require_version('Gtk', '3.0')

from gi.repository import Gtk

it = Gtk.TreeIter()
it.user_data = 0

This is what mypy says:

$ mypy repr.py
repr.py:8: error: Incompatible types in assignment (expression has type "int", variable has type "None")  [assignment]
Found 1 error in 1 file (checked 1 source file)

Here is the definition of TreeIter in _Gtk3.pyi:

class TreeIter(GObject.GBoxed):
    stamp: int = ...
    user_data: None = ...
    user_data2: None = ...
    user_data3: None = ...
    def copy(self) -> TreeIter: ...
    def free(self) -> None: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions