- changed status to wontfix
consistent attribute history with no side effects
Issue #2128
resolved
with #2127 I'm digging into the inconsistencies in history reporting. I don't think we can change the conventions too heavily at this point in 0.7. This ticket would address inconsistencies like this:
def test_scalar_init():
class Foo(object):
pass
instrumentation.register_class(Foo)
attributes.register_attribute(Foo, 'someattr', uselist=False,
useobject=False, active_history=True)
f = Foo()
assert \
attributes.get_state_history(attributes.instance_state(f), 'someattr') == \
((), (), ())
def test_object_init():
class Foo(object):
pass
instrumentation.register_class(Foo)
attributes.register_attribute(Foo, 'someattr', uselist=False,
useobject=True, active_history=True)
f = Foo()
assert \
attributes.get_state_history(attributes.instance_state(f), 'someattr') == \
((), [None](None), ())
and others. Symbols like NEVER_SET, NO_VALUE should be used in a fully consistent way for scalars, and object scalars, and full detail should be returned in history tuples - no more returning ()
when we are actually able to tell if the value was previously present or not. The "default value" of None
being set in get()
needs to never occur when doing history - this is a side effect. A facade for the current get_history() should be supplied to provide backwards compatibility, if possible.
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.8.0b1 (automated comment)
- Log in to comment
can't reproduce - added the above test in 2d154b01f15b1c9addd16fde3d3299224baa5d22 and the history is consistent for both, so not sure what was up here. Other changes in the attribute system may have resolved this.