Skip to content

avoid infinite recursion cross-validating defaults#435

Closed
minrk wants to merge 1 commit intoipython:masterfrom
minrk:cycle-validate-defaults
Closed

avoid infinite recursion cross-validating defaults#435
minrk wants to merge 1 commit intoipython:masterfrom
minrk:cycle-validate-defaults

Conversation

@minrk
Copy link
Member

@minrk minrk commented Aug 8, 2017

When validating defaults, load initial values prior to cross-validation

Downside: this means that accessing other values during validation can return non-final values in the event of cross-validation cycles (@validate(a) depends on self.b and @validate(b) depends on self.a). But this is only true for validated default values with cross-references where validation would mutate the default values, which really really shouldn't happen.

While this does appear to pass the ipywidgets and IPython tests with current stable versions, I'm not sure that cross-validating defaults is going to be worth the trouble. There are way too many edge cases where it could trigger, validating an unused value, raising an unhelpful error about code that's not relevant.

closes #363
closes #428
closes #434
closes jupyter-widgets/ipywidgets#1423

cc @rmorshea @SylvainCorlay @jasongrout

When validating defaults, load initial values prior to cross-validation

Downside: this means that accessing other values during validation
can return non-final values in the event of cross-validation cycles
(`@validate(a)` depends on self.b and `@validate(b)` depends on self.a).
But this is only true for validated default values with cross-references
where validation would mutate the default values,
which is the same as having invalid default values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any() trait not validated Recursion error running tests with master Traitlets master breaks ipywidgets

1 participant