traits icon indicating copy to clipboard operation
traits copied to clipboard

Reading from an `Event` trait inside a `Tuple` trait should be an error

Open mdickinson opened this issue 2 years ago • 2 comments

Reading the value of an Event() trait should be an error, even when it's contained in another trait type. But we have the following behaviour in current Traits:

>>> from traits.api import HasTraits, Event, Tuple
>>> 
>>> class A(HasTraits):
...     foo = Tuple(Event(), Event())
... 
>>> a = A()
>>> a.foo
(<undefined>, <undefined>)

mdickinson avatar Sep 20 '21 12:09 mdickinson

Labelling as a bug, though it doesn't seem like a problem that's likely to turn up in real code. Not a high priority to fix for upcoming releases.

mdickinson avatar Sep 20 '21 15:09 mdickinson

Whoops; I accidentally autoclosed this by merging #1546 (which said "This PR doesn't fix #1541"). Re-opening.

mdickinson avatar Sep 24 '21 11:09 mdickinson