Skip to content

Trait default values are validated even when not ever used #7769

@SylvainCorlay

Description

@SylvainCorlay
from IPython.utils.traitlets import *

class Foo(HasTraits):
    bar = Type(allow_none=False)

foo = Foo(bar=int)

yields The 'bar' trait of a Foo instance must be a subclass of object, but a value of type 'NoneType' (i.e. None) was specified.

The default value is validated while it is not needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions