Gio python binding don't like STRINGV values
Submitted by Kévin Bernard-Allies
Link to original bug (#778252)
Description
I try to change file emblems (file attributes of type STRINGV), using Gio. All attempts to use the STRINGV type either are explicitly refused or segfault.
- Neither Gio.File.set_attribute() nor Gio.FileInfo.set_attribute() accepts STRINGV arguments.
>>> from gi.repository import Gio
>>> Gio._version
'2.0'
>>> f = Gio.File.new_for_path('test')
>>> f.set_attribute("metadata::emblems",
Gio.FileAttributeType.STRINGV,
["folder_emblem_in_progress"],
Gio.FileQueryInfoFlags(0),
None)
ValueError: Pointer arguments are restricted to integers, capsules, and None. See: https://bugzilla.gnome.org/show_bug.cgi?id=683599
2. Gio.FileInfo.set_attribute_stringv() segfault.
>>> from gi.repository import Gio
>>> fi = Gio.FileInfo()
>>> fi.set_attribute_stringv("metadata::emblems", ["folder_emblem_in_progress"])
[1] 21457 segmentation fault (core dumped) python
Note that it worked with the old Gio binding:
>>> import gio
>>>
>>> f = gio.File(file_path)
>>> f.set_attribute("metadata::emblems",
gio.FILE_ATTRIBUTE_TYPE_STRINGV,
["folder_emblem_in_progress"])