GNOME Bugzilla – Bug 767268
Add missing filename type annotations
Last modified: 2018-11-03 12:34:54 UTC
Created attachment 329156 [details] [review] Add missing filename type annotations I'm currently working on improving filename handling support in PyGObject which depends on filenames being annotated as such. See bug 746564
Review of attachment 329156 [details] [review]: What is the exact difference between a string and a filename, other than the semantic difference? How is it handled differently, is the string encoding possibly different, ...? ::: gst/gst.c @@ +318,3 @@ * @argc: (inout) (allow-none): pointer to application's argc + * @argv: (inout) (array length=argc) (element-type filename) (allow-none): + * pointer to application's argv Why is argv an array of "filenames"? It's arbitrary command line arguments
(In reply to Sebastian Dröge (slomo) from comment #1) > Review of attachment 329156 [details] [review] [review]: > > What is the exact difference between a string and a filename, other than the > semantic difference? How is it handled differently, is the string encoding > possibly different, ...? A text string is valid utf-8 while a filename is a null terminated array of bytes on Unix and valid utf-8 on Windows. > ::: gst/gst.c > @@ +318,3 @@ > * @argc: (inout) (allow-none): pointer to application's argc > + * @argv: (inout) (array length=argc) (element-type filename) (allow-none): > + * pointer to application's argv > > Why is argv an array of "filenames"? It's arbitrary command line arguments It just matches the semantics stated above, null terminated bytes on Unix, valid utf-8 on Windows.
Not sure what you're trying to do here, but wouldn't it be better to do this in GOptionParser somewhere?
My goal is to make "sys.argv = Gst.init(sys.arv)" not crash with Python 3 if argv contains non-utf8 data.
Created attachment 329316 [details] [review] Add missing filename type annotations Now without argv changes.
Question is if this generally makes sense or is just something for Python. What is the opinion of the G-I people about this?
I've just send a message to gir-devel-list to get some advice: https://mail.gnome.org/archives/gir-devel-list/2016-June/msg00000.html
Please let us know the result of that discussion :)
I got one response and no objections. See https://mail.gnome.org/archives/gir-devel-list/2016-June/thread.html#00000 So I'd like to propose the original patch for inclusion.
Let's wait for what Gtk+ folks do with this. Still seems dubious to me.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/174.