@@ -380,6 +380,8 @@ def __init__(self, sequence=None, *, name=None):
380380
381381 def _get_packing_format (self , position ):
382382 "Gets the packing format for a single value stored in the list."
383+ if type (position ) != int :
384+ raise TypeError ("ShareableList indices must be integer" )
383385 position = position if position >= 0 else position + self ._list_len
384386 if (position >= self ._list_len ) or (self ._list_len < 0 ):
385387 raise IndexError ("Requested position out of range." )
@@ -397,6 +399,8 @@ def _get_packing_format(self, position):
397399 def _get_back_transform (self , position ):
398400 "Gets the back transformation function for a single value."
399401
402+ if type (position ) != int :
403+ raise TypeError ("ShareableList indices must be integer" )
400404 if (position >= self ._list_len ) or (self ._list_len < 0 ):
401405 raise IndexError ("Requested position out of range." )
402406
@@ -413,6 +417,8 @@ def _set_packing_format_and_transform(self, position, fmt_as_str, value):
413417 """Sets the packing format and back transformation code for a
414418 single value in the list at the specified position."""
415419
420+ if type (position ) != int :
421+ raise TypeError ("ShareableList indices must be integer" )
416422 if (position >= self ._list_len ) or (self ._list_len < 0 ):
417423 raise IndexError ("Requested position out of range." )
418424
@@ -432,6 +438,8 @@ def _set_packing_format_and_transform(self, position, fmt_as_str, value):
432438 )
433439
434440 def __getitem__ (self , position ):
441+ if type (position ) != int :
442+ raise TypeError ("ShareableList indices must be integer" )
435443 position = position if position >= 0 else position + self ._list_len
436444 try :
437445 offset = self ._offset_data_start + self ._allocated_offsets [position ]
@@ -449,6 +457,8 @@ def __getitem__(self, position):
449457 return v
450458
451459 def __setitem__ (self , position , value ):
460+ if type (position ) != int :
461+ raise TypeError ("ShareableList indices must be integer" )
452462 position = position if position >= 0 else position + self ._list_len
453463 try :
454464 item_offset = self ._allocated_offsets [position ]
0 commit comments