← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1282514] Re: python 3 only has "__self__", the "im_self" should be replace by "__self_"

 

** Also affects: nova
   Importance: Undecided
       Status: New

** Changed in: nova
     Assignee: (unassigned) => Xurong Yang (idopra)

** Changed in: nova
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1282514

Title:
  python 3 only has  "__self__", the "im_self" should be replace by
  "__self_"

Status in Cinder:
  In Progress
Status in Ironic (Bare Metal Provisioning):
  In Progress
Status in OpenStack Compute (Nova):
  In Progress
Status in Oslo - a Library of Common OpenStack Code:
  In Progress
Status in Tuskar:
  In Progress

Bug description:
  for code compatible with Python 3, we should use the "__self__" instead of "im_self".
  for example :
  cinder/volume/flows/common.py

  def make_pretty_name(method):
      """Makes a pretty name for a function/method."""
      meth_pieces = [method.__name__]
      # If its an instance method attempt to tack on the class name
      if hasattr(method, 'im_self') and method.im_self is not None:
          try:
              meth_pieces.insert(0, method.im_self.__class__.__name__)
          except AttributeError:
              pass
      return ".".join(meth_pieces)

  For reference here(thanks Alex for adding this):
  "Changed in version 2.6: For Python 3 forward-compatibility, im_func is also available as __func__, and im_self as __self__."
  http://docs.python.org/2/reference/datamodel.html

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