How to add Vala generics to PyGObject



I have filed a bug #677960 with the following description:

PyGObject support GLib.List<G> and GLib.Hash<K,V>, but what about Vala/Gee generics?

How can I create a GLib.List<string> in Python and how can I do the same for Vala/Gee generics?

May be defining a C API that defines functions that can handle generics and Python could define the type to use.

Gee's GIR defines lot of interfaces and most of them are Generics. Particulary when I use:

>> from gi.repository import Gee

works correctly but when try to use the interfaces or just to check it exists as type I wrote:

>> Gee.List

I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 180, in __getattr__
    wrapper = metaclass(name, bases, dict_)
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 232, in __init__
    register_interface_info(cls.__info__.get_g_type())
TypeError: must be an interface


By inspecting Gee's tree I found that most classes implement and interfaces have as prerequisite Gee.Traversable, but it is not defined:

>> Gee.Traversable

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 105, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Gee' object has no attribute 'Traversable'



--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]