GNOME Bugzilla – Bug 766396
io_add_watch is broken for sockets on Windows
Last modified: 2016-09-03 16:21:19 UTC
Created attachment 327824 [details] [review] proposed patch It's possible to pass file descriptors and file-like objects (like sockets) to io_add_watch. Unfortunately the code in the overrides [1] creates unix channels. On Windows, this leads to a socket fd being used as a file fd which eventually segfaults python. When passing an int, it's up to the user what he passes, so we can't check whether it's an file or socket fd. But when the user passes a socket we can. See the attachment for a proposed patch that checks whether the user passed a socket and uses win32_new_socket if appropriate. Test: https://gist.github.com/carrotIndustries/aefd4552745096ac47ce4f920b0958e1 [1] https://git.gnome.org/browse/pygobject/tree/gi/overrides/GLib.py#n726
Review of attachment 327824 [details] [review]: Thanks. Looks reasonable to me. (Any objections from anyone else?)
Since no one objected how about merging this patch?
Review of attachment 327824 [details] [review]: lgtm
https://git.gnome.org/browse/pygobject/commit/?id=1cb6c470e9d297afda21b73efaccb0b95e519b5d