RESOLVED FIXED Bug 225230
[webkitpy] Support pickling platforminfo
https://bugs.webkit.org/show_bug.cgi?id=225230
Summary [webkitpy] Support pickling platforminfo
Jonathan Bedard
Reported 2021-04-30 08:56:43 PDT
We need to be able to pickle the platforminfo object.
Attachments
Patch (4.75 KB, patch)
2021-04-30 09:03 PDT, Jonathan Bedard
no flags
Patch (5.18 KB, patch)
2021-04-30 13:37 PDT, Jonathan Bedard
no flags
Patch for landing (5.27 KB, patch)
2021-05-03 15:52 PDT, Jonathan Bedard
no flags
Radar WebKit Bug Importer
Comment 1 2021-04-30 08:58:24 PDT
Jonathan Bedard
Comment 2 2021-04-30 09:03:47 PDT
Stephanie Lewis
Comment 3 2021-04-30 09:13:21 PDT
Comment on attachment 427427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427427&action=review > Tools/Scripts/webkitpy/common/system/platforminfo.py:66 > self._platform_module = platform_module Why not self.platform_module or platform?
Jonathan Bedard
Comment 4 2021-04-30 09:15:47 PDT
Comment on attachment 427427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427427&action=review >> Tools/Scripts/webkitpy/common/system/platforminfo.py:66 >> self._platform_module = platform_module > > Why not self.platform_module or platform? Because you can't pickle a module. Doing `self.platform_module or platform` would mean we could not pickle the PlatformInfo object
Jonathan Bedard
Comment 5 2021-04-30 09:33:37 PDT
Waiting on EWS before landing.
Sam Sneddon [:gsnedders]
Comment 6 2021-04-30 09:33:42 PDT
Comment on attachment 427427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427427&action=review > Tools/Scripts/webkitpy/common/system/platforminfo.py:62 > + def __init__(self, sys_module=None, platform_module=None, executive=None): I'm still marginally worried about making these optional, in case we forget that these to need to be passed, especially when in WebKit these are always the 'standard' objects. Do you have any idea of any approach to make sure that we remember to pass these when needed? > Tools/Scripts/webkitpy/common/system/platforminfo.py:139 > + return "Mac OS X %s" % (self._platform_module or platform).mac_ver()[0] I feel like it would be clearer to just use self._platform_module everywhere and then delete it if it is platform in __getstate__ (and reintroduce it if omitted in __setstate__)? Either that or make it self._platform_module_override and add a getter for _platform_module which does this?
Jonathan Bedard
Comment 7 2021-04-30 09:54:59 PDT
(In reply to Sam Sneddon [:gsnedders] from comment #6) > Comment on attachment 427427 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=427427&action=review > > > Tools/Scripts/webkitpy/common/system/platforminfo.py:62 > > + def __init__(self, sys_module=None, platform_module=None, executive=None): > > I'm still marginally worried about making these optional, in case we forget > that these to need to be passed, especially when in WebKit these are always > the 'standard' objects. Do you have any idea of any approach to make sure > that we remember to pass these when needed? PlatformInfo objects shouldn't be instantiated outside of the Host, and the defaults we're setting here are correct unless you have a specific reason to override them. It seems to me that naively instantiation the PlatformInfo object with this set of default arguments would give you what you're looking for. The other option would be to not set defaults here, but still support "None" as an argument. > > > Tools/Scripts/webkitpy/common/system/platforminfo.py:139 > > + return "Mac OS X %s" % (self._platform_module or platform).mac_ver()[0] > > I feel like it would be clearer to just use self._platform_module everywhere > and then delete it if it is platform in __getstate__ (and reintroduce it if > omitted in __setstate__)? > > Either that or make it self._platform_module_override and add a getter for > _platform_module which does this? The problem I see with this approach is that if the platform_module isn't the default, it likely is able to be pickled (and that's probably what we want to do).
EWS
Comment 8 2021-04-30 11:22:36 PDT
Committed r276846 (237197@main): <https://commits.webkit.org/237197@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427427 [details].
WebKit Commit Bot
Comment 9 2021-04-30 12:10:39 PDT
Re-opened since this is blocked by bug 225242
Jonathan Bedard
Comment 10 2021-04-30 13:37:15 PDT
Aakash Jain
Comment 11 2021-05-03 15:25:50 PDT
rs=me
Jonathan Bedard
Comment 12 2021-05-03 15:52:36 PDT
Created attachment 427608 [details] Patch for landing
EWS
Comment 13 2021-05-03 16:41:59 PDT
Committed r276935 (237271@main): <https://commits.webkit.org/237271@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427608 [details].
Note You need to log in before you can comment on or make changes to this bug.