-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
made a minor fix to one of the widget examples #5493
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
Conversation
I tried to check this, but I ran into #5499. |
Fix for the fact that dictionary randomization sometimes switches the order of the arguments passed to the class on initialization. This means that, potentially, 'value' can be updated BEFORE 'values', and since the method to update 'value' checks to see whether it exists in 'values', this breaks things.
I updated the PR with a potential fix for #5499 - this is definitely a dictionary randomization issue, and I think it's cleanest to force the values update during init so that it precedes other possible changes. |
Thanks! Only question: should we be using @jdfreder , I've assigned this to you for a quick review. |
My original pass at a fix actually did use kwargs.pop, but given my lack of knowledge about the traitlets framework, I was hesitant to suppress the passing of 'values' just in case something else was being done with it. |
I don't think so, but to be honest traitlets is rather black magic to me as well. @minrk would know better. |
pop should be okay. All init does with kwargs is iterate and setattr, so if you are already handling that, it should be fine to prevent it happening a second time. |
The code here looks good to me 👍 . I thought we had a problem with the validation firing before values was set before, and that we had fixed it, but it looks like I was wrong. Thanks for catching the typo too! |
Thanks. @jdavidheiser , do you want to change it back to |
@jdfreder - was the previous issue with values getting set related to the thread locking? I couldn't find threading being used in a similar way anywhere else, so at first I actually thought this issue had something to do with threading, before I confirmed the kwargs randomization issue by running the code with PYTHONHASHSEED set to different values. |
No, IIRC it was just impossible to construct a SelectionWidget with values set in the constructor. |
yeah, sorry about that - serves me right for trying to rush something before dinner and make the code sloppy |
made a minor fix to one of the widget examples
Backport PR #5493: made a minor fix to one of the widget examples
made a minor fix to one of the widget examples
No description provided.