micropython

Changeset

618:a61f326ec2b2
2012-11-04 Paul Boddie raw files shortlog changelog graph Fixed acquisition of the pre-made type class for __class__ attributes.
micropython/data.py (file) micropython/inspect.py (file)
     1.1 --- a/micropython/data.py	Sun Nov 04 23:31:22 2012 +0100
     1.2 +++ b/micropython/data.py	Sun Nov 04 23:41:06 2012 +0100
     1.3 @@ -2151,6 +2151,9 @@
     1.4      "type" : Class("type"),
     1.5      }
     1.6  
     1.7 +def get_constant_class(name):
     1.8 +    return premade[name]
     1.9 +
    1.10  # Class construction.
    1.11  
    1.12  def get_class(name, parent, module, node):
     2.1 --- a/micropython/inspect.py	Sun Nov 04 23:31:22 2012 +0100
     2.2 +++ b/micropython/inspect.py	Sun Nov 04 23:41:06 2012 +0100
     2.3 @@ -669,7 +669,7 @@
     2.4                  # Check for class.__class__.
     2.5  
     2.6                  if attrname == "__class__" and isinstance(value, Class):
     2.7 -                    attr = type_class
     2.8 +                    attr = get_constant_class("type")
     2.9                  else:
    2.10                      attr = value.get(attrname) or make_instance()
    2.11                  self.use_specific_attribute(value.full_name(), attrname)