New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure fuse order is read in a stable way #29599
Conversation
@@ -50,7 +51,7 @@ | |||
""" | |||
|
|||
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f: | |||
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/")) | |||
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/"), object_pairs_hook=OrderedDict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will sort the keys alphabetically, right? Is that what we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this will keep keys in the order in which they are added.
dict subclass that remembers the order entries were added
And the JSON loader adds them in order of appearance.
Release Notes Persisted
|
I have automatically backported this PR to "13-x-y", please check out #29615 |
I have automatically backported this PR to "14-x-y", please check out #29616 |
python2 and python3 have subtley different behavior when getting
keys()
from a JSON parsed dictionary. Forcing the dictionary to be anOrderedDict
ensures the behavior is consistent (and what we have documented).Notes: Electron Fuses are now in a consistent order across platforms