← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1613409] Re: Sentinel doesn't work with copy()

 

Reviewed:  https://review.openstack.org/355606
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=13fe2cf065fc431782459f5d89e2df903e4c40b9
Submitter: Jenkins
Branch:    master

commit 13fe2cf065fc431782459f5d89e2df903e4c40b9
Author: Boden R <bodenvmw@xxxxxxxxx>
Date:   Mon Aug 15 13:14:01 2016 -0600

    Support copy() in Sentinel
    
    The current impl of Sentinel doesn't return the singleton
    instance when used with copy.copy(), but it does with
    copy.deepcopy(). This behavior is inconsistent.
    
    This patch adds support for copy.copy() as well as a UT.
    
    Change-Id: I33225f5a6e62be9647edacd4b3bd25702e6d8141
    Closes-Bug: #1613409


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1613409

Title:
  Sentinel doesn't work with copy()

Status in neutron:
  Fix Released

Bug description:
  The Sentinel object in neutron_lib.constants doesn't return the
  sentinel object when used with copy.copy(), but it does with
  copy.deepcopy().

  This behavior is inconsistent as deepcopy keeps the singleton
  behavior, but copy doesn't.

  For example:
  ---
  import copy

  from neutron_lib.constants import Sentinel

  
  singleton = Sentinel()
  print(copy.deepcopy(singleton) == copy.copy(singleton))
  ---

  Outputs 'False'.

  
  [1] https://github.com/openstack/neutron-lib/blob/master/neutron_lib/constants.py#L255

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1613409/+subscriptions


References