1.1 --- a/micropython/__init__.py Fri Jan 16 00:52:04 2009 +0100
1.2 +++ b/micropython/__init__.py Sat Jan 17 22:33:19 2009 +0100
1.3 @@ -499,16 +499,17 @@
1.4
1.5 "Return a constant for the given 'value'."
1.6
1.7 - return self.constant_values[value]
1.8 + const = micropython.data.Const(value)
1.9 + return self.constant_values[const]
1.10
1.11 def make_constant(self, value):
1.12
1.13 "Make and return a constant for the given 'value'."
1.14
1.15 - if not self.constant_values.has_key(value):
1.16 - const = micropython.data.Const(value)
1.17 - self.constant_values[value] = const
1.18 - return self.constant_values[value]
1.19 + const = micropython.data.Const(value)
1.20 + if not self.constant_values.has_key(const):
1.21 + self.constant_values[const] = const
1.22 + return self.constant_values[const]
1.23
1.24 def constants(self):
1.25
2.1 --- a/micropython/data.py Fri Jan 16 00:52:04 2009 +0100
2.2 +++ b/micropython/data.py Sat Jan 17 22:33:19 2009 +0100
2.3 @@ -349,7 +349,7 @@
2.4 # Support constants as dictionary keys in order to build constant tables.
2.5
2.6 def __eq__(self, other):
2.7 - return self.value == other.value
2.8 + return self.value == other.value and self.value.__class__ is other.value.__class__
2.9
2.10 def __hash__(self):
2.11 return hash(self.value)