commit deffb09871c9460497929c57bd82ca78d1c3177f
Author: Chris Dent <email address hidden>
Date: Thu Dec 13 20:56:39 2018 +0000
Make QuotaImageTagsProxy deep-copyable
Infinite recursion is possible if you try to deepcopy a
QuotaImageTagsProxy object, which is something that happens when using
oslo.policy 1.43.1 and beyond.
By adding a __gettattribute__ within the __getattr__ method we can break
the loop when the name of the attribute is 'tags'.
The added test will fail (with infinite recursion) if the new code is
removed.
For completeness a test is added checking what happens when the tags
attribute is removed.
The thing that is not immediately clear from the __getattr__ code is
that it is not for getting at the tags themselves, it is for getting
at the methods on the set object at self.tags. The non-obviousness
of this led to rather a lot of confusion while trying to get this
code right. It isn't really "right" now, but rather: safe in the
context of its use.
Reviewed: https:/ /review. openstack. org/625114 /git.openstack. org/cgit/ openstack/ glance/ commit/ ?id=deffb09871c 9460497929c57bd 82ca78d1c3177f
Committed: https:/
Submitter: Zuul
Branch: master
commit deffb09871c9460 497929c57bd82ca 78d1c3177f
Author: Chris Dent <email address hidden>
Date: Thu Dec 13 20:56:39 2018 +0000
Make QuotaImageTagsProxy deep-copyable
Infinite recursion is possible if you try to deepcopy a agsProxy object, which is something that happens when using
QuotaImageT
oslo.policy 1.43.1 and beyond.
By adding a __gettattribute__ within the __getattr__ method we can break
the loop when the name of the attribute is 'tags'.
The added test will fail (with infinite recursion) if the new code is
removed.
For completeness a test is added checking what happens when the tags
attribute is removed.
The thing that is not immediately clear from the __getattr__ code is
that it is not for getting at the tags themselves, it is for getting
at the methods on the set object at self.tags. The non-obviousness
of this led to rather a lot of confusion while trying to get this
code right. It isn't really "right" now, but rather: safe in the
context of its use.
Change-Id: Ic47c9bf8e9b97d e5a5a49a35f6317 53c54e0e2af
Related-Bug: #1808063