Compound fields do not coerce values of their elements when modified

Bug #1466057 reported by Alexander Tivelkov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.versionedobjects
Confirmed
Medium
Unassigned

Bug Description

Compound fields coerce the values of their elements only during initial assignment. When the field is modified afterwards, no coercing happens, thus collections may get invalid values.

For example:

@base.VersionedObjectRegistry.register
class Foo(base.VersionedObject):
    fields = {
        "bar": fields.Field(fields.List(fields.Integer))
    }

f = Foo(bar=[42])

# All the lines below should fail, as "blah" can't be coerced to Integer, but actually they all work:
f.bar[0] = "blah"
f.bar.append("blah")
f.bar.extend(["blah", "blah"])
f.bar.insert(0, "blah")

Changed in oslo.versionedobjects:
assignee: nobody → Alexander Tivelkov (ativelkov)
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Alexander,

was this about the change that was reverted?

https://review.openstack.org/#/c/196926/

Changed in oslo.versionedobjects:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Alexander Tivelkov (ativelkov) wrote :

Dims, yes, this is the bug I reported before submitting that change.

Changed in oslo.versionedobjects:
status: In Progress → Confirmed
Revision history for this message
ChangBo Guo(gcb) (glongwave) wrote :

The fix was revert , so set with confirm status.

Changed in oslo.versionedobjects:
assignee: Alexander Tivelkov (ativelkov) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.