1.1 --- a/rsvplib.py Tue Aug 31 00:59:16 2010 +0200
1.2 +++ b/rsvplib.py Sat Sep 04 00:55:37 2010 +0200
1.3 @@ -291,16 +291,24 @@
1.4 header = self.machine.load(fragment.ref)
1.5 nelements = header.occupied_size - 1
1.6
1.7 - # NOTE: Assume single location for data and header.
1.8 + # Test operand suitability.
1.9 +
1.10 + if self.machine._CheckInstance(item_value.ref, self.int_class):
1.11
1.12 - item_pos = self.machine.load(item_value.ref + 1)
1.13 + # NOTE: Assume single location for data and header.
1.14 +
1.15 + item_pos = self.machine.load(item_value.ref + 1)
1.16
1.17 - if item_pos >= 0 and item_pos < nelements:
1.18 - pass
1.19 - elif item_pos < 0 and item_pos >= -nelements:
1.20 - item_pos = nelements + item_pos
1.21 + if item_pos >= 0 and item_pos < nelements:
1.22 + pass
1.23 + elif item_pos < 0 and item_pos >= -nelements:
1.24 + item_pos = nelements + item_pos
1.25 + else:
1.26 + self.machine.exception = self.machine._MakeObject(2, self.index_error_instance)
1.27 + return self.machine.RaiseException()
1.28 +
1.29 else:
1.30 - self.machine.exception = self.machine._MakeObject(2, self.index_error_instance)
1.31 + self.machine.exception = self.machine._MakeObject(2, self.type_error_instance)
1.32 return self.machine.RaiseException()
1.33
1.34 # NOTE: Assume single location for header.