uuidsentinel does not follow __getattr__ protocol

Bug #1885281 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.utils
Fix Released
Undecided
Balazs Gibizer

Bug Description

uuidsentinel raises a ValueError if called __getattr__ called with an attribute starting with '_' This breaks the getattr protocol by making getattr() builtin to raise instead of return the value of the default args. This breaks nova unit test under mock 4.0.x [1].

The proper exception would be an AttributeError as stated by [2]

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963339
[2] https://python-reference.readthedocs.io/en/latest/docs/dunderattr/getattr.html#remarks

Changed in oslo.utils:
assignee: nobody → Balazs Gibizer (balazs-gibizer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.utils (master)

Fix proposed to branch: master
Review: https://review.opendev.org/738207

Changed in oslo.utils:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.utils (master)

Reviewed: https://review.opendev.org/738207
Committed: https://git.openstack.org/cgit/openstack/oslo.utils/commit/?id=bc562f3393e976e7086642f03ef62a914a9b2dcc
Submitter: Zuul
Branch: master

commit bc562f3393e976e7086642f03ef62a914a9b2dcc
Author: Balazs Gibizer <email address hidden>
Date: Fri Jun 26 15:34:52 2020 +0200

    Fix uuidsentinel to follow getattr protocol

    This patch changes the exception type raise by uuidsentinel when the
    sentinel name starts with '_'. The __getattr__ protocol requires to
    raise an AttributeError if the attribute value cannot be returned.

    Closes-Bug: #1885281
    Change-Id: I1076a957a19507e7d96ef429c0ae5d0ee8a90e66

Changed in oslo.utils:
status: In Progress → Fix Released
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.