Skip to content

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

Merged
merged 5 commits into from
Apr 4, 2014
Merged

made a minor fix to one of the widget examples #5493

merged 5 commits into from
Apr 4, 2014

Conversation

jdavidheiser
Copy link
Contributor

No description provided.

@takluyver takluyver added this to the 2.1 milestone Apr 2, 2014
@takluyver takluyver added the docs label Apr 2, 2014
@takluyver
Copy link
Member

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.
@jdavidheiser
Copy link
Contributor Author

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.

@takluyver
Copy link
Member

Thanks! Only question: should we be using kwargs.pop('values'), to save setting the traitlet twice?

@jdfreder , I've assigned this to you for a quick review.

@jdavidheiser
Copy link
Contributor Author

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.

@takluyver
Copy link
Member

I don't think so, but to be honest traitlets is rather black magic to me as well. @minrk would know better.

@minrk
Copy link
Member

minrk commented Apr 4, 2014

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.

@jdfreder
Copy link
Contributor

jdfreder commented Apr 4, 2014

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!

@takluyver
Copy link
Member

Thanks. @jdavidheiser , do you want to change it back to pop(), and we'll merge this?

@jdavidheiser
Copy link
Contributor Author

@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.

@jdfreder
Copy link
Contributor

jdfreder commented Apr 4, 2014

related to the thread locking

No, IIRC it was just impossible to construct a SelectionWidget with values set in the constructor.

@jdavidheiser
Copy link
Contributor Author

yeah, sorry about that - serves me right for trying to rush something before dinner and make the code sloppy

jdfreder added a commit that referenced this pull request Apr 4, 2014
made a minor fix to one of the widget examples
@jdfreder jdfreder merged commit f648985 into ipython:master Apr 4, 2014
jdfreder added a commit to jdfreder/ipython that referenced this pull request Apr 4, 2014
takluyver added a commit that referenced this pull request Apr 4, 2014
Backport PR #5493: made a minor fix to one of the widget examples
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
made a minor fix to one of the widget examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants