@@ -171,9 +171,9 @@ Object concat(PArray self, int value) {
171
171
int newLength = Math .max (PythonUtils .multiplyExact (self .getLength (), value ), 0 );
172
172
int itemsize = self .getFormat ().bytesize ;
173
173
PArray newArray = factory ().createArray (self .getFormatStr (), self .getFormat (), newLength );
174
- int segmentLenght = self .getLength () * itemsize ;
174
+ int segmentLength = self .getLength () * itemsize ;
175
175
for (int i = 0 ; i < value ; i ++) {
176
- PythonUtils .arraycopy (self .getBuffer (), 0 , newArray .getBuffer (), segmentLenght * i , segmentLenght );
176
+ PythonUtils .arraycopy (self .getBuffer (), 0 , newArray .getBuffer (), segmentLength * i , segmentLength );
177
177
}
178
178
return newArray ;
179
179
} catch (OverflowException e ) {
@@ -201,10 +201,10 @@ Object concat(PArray self, int value) {
201
201
try {
202
202
int newLength = Math .max (PythonUtils .multiplyExact (self .getLength (), value ), 0 );
203
203
int itemsize = self .getFormat ().bytesize ;
204
- int segmentLenght = self .getLength () * itemsize ;
204
+ int segmentLength = self .getLength () * itemsize ;
205
205
self .resize (newLength );
206
206
for (int i = 0 ; i < value ; i ++) {
207
- PythonUtils .arraycopy (self .getBuffer (), 0 , self .getBuffer (), segmentLenght * i , segmentLenght );
207
+ PythonUtils .arraycopy (self .getBuffer (), 0 , self .getBuffer (), segmentLength * i , segmentLength );
208
208
}
209
209
return self ;
210
210
} catch (OverflowException e ) {
@@ -470,7 +470,7 @@ Object setitem(PArray self, PSlice slice, PArray other,
470
470
@ Cached ConditionProfile sameArrayProfile ,
471
471
@ Cached ConditionProfile simpleStepProfile ,
472
472
@ Cached ConditionProfile complexDeleteProfile ,
473
- @ Cached ConditionProfile differentLenghtProfile ,
473
+ @ Cached ConditionProfile differentLengthProfile ,
474
474
@ Cached ConditionProfile growProfile ,
475
475
@ Cached ConditionProfile stepAssignProfile ,
476
476
@ Cached SliceLiteralNode .SliceUnpack sliceUnpack ,
@@ -489,7 +489,7 @@ Object setitem(PArray self, PSlice slice, PArray other,
489
489
PythonUtils .arraycopy (other .getBuffer (), 0 , sourceBuffer , 0 , sourceBuffer .length );
490
490
}
491
491
if (simpleStepProfile .profile (step == 1 )) {
492
- if (differentLenghtProfile .profile (sliceLength != needed )) {
492
+ if (differentLengthProfile .profile (sliceLength != needed )) {
493
493
if (growProfile .profile (sliceLength < needed )) {
494
494
if (stop < start ) {
495
495
stop = start ;
@@ -568,7 +568,7 @@ static Object delitem(PArray self, PSlice slice,
568
568
PythonUtils .arraycopy (self .getBuffer (), (cur + 1 ) * itemsize , self .getBuffer (), (cur - offset ) * itemsize , (step - 1 ) * itemsize );
569
569
}
570
570
PythonUtils .arraycopy (self .getBuffer (), (cur + 1 ) * itemsize , self .getBuffer (), (cur - offset ) * itemsize , (length - cur - 1 ) * itemsize );
571
- self .setLenght (length - sliceLength );
571
+ self .setLength (length - sliceLength );
572
572
}
573
573
}
574
574
return PNone .NONE ;
@@ -690,7 +690,7 @@ Object extend(PArray self, PArray value) {
690
690
int itemsize = self .getFormat ().bytesize ;
691
691
self .ensureCapacity (newLength );
692
692
PythonUtils .arraycopy (value .getBuffer (), 0 , self .getBuffer (), self .getLength () * itemsize , value .getLength () * itemsize );
693
- self .setLenght (newLength );
693
+ self .setLength (newLength );
694
694
return PNone .NONE ;
695
695
} catch (OverflowException e ) {
696
696
CompilerDirectives .transferToInterpreterAndInvalidate ();
@@ -705,33 +705,33 @@ Object extend(VirtualFrame frame, PArray self, PSequence value,
705
705
@ Cached SequenceStorageNodes .LenNode lenNode ,
706
706
@ Cached SequenceStorageNodes .GetItemScalarNode getItemNode ) {
707
707
SequenceStorage storage = getSequenceStorageNode .execute (value );
708
- int storageLenght = lenNode .execute (storage );
708
+ int storageLength = lenNode .execute (storage );
709
709
boolean capacityEnsured = false ;
710
710
try {
711
- self .ensureCapacity (PythonUtils .addExact (self .getLength (), storageLenght ));
711
+ self .ensureCapacity (PythonUtils .addExact (self .getLength (), storageLength ));
712
712
capacityEnsured = true ;
713
713
} catch (OverflowException e ) {
714
714
CompilerDirectives .transferToInterpreterAndInvalidate ();
715
715
// Let it fail later, so that it fails in the same state as the generic
716
716
// specialization
717
717
}
718
- int lenght = self .getLength ();
719
- for (int i = 0 ; i < storageLenght ; i ++) {
718
+ int length = self .getLength ();
719
+ for (int i = 0 ; i < storageLength ; i ++) {
720
720
// The whole extend is not atomic, just individual inserts are. That's the same as
721
721
// in CPython
722
722
if (capacityEnsured ) {
723
- lenght ++;
723
+ length ++;
724
724
} else {
725
725
try {
726
- lenght = PythonUtils .addExact (lenght , 1 );
727
- self .ensureCapacity (lenght );
726
+ length = PythonUtils .addExact (length , 1 );
727
+ self .ensureCapacity (length );
728
728
} catch (OverflowException e ) {
729
729
CompilerDirectives .transferToInterpreterAndInvalidate ();
730
730
throw raise (MemoryError );
731
731
}
732
732
}
733
- putValueNode .execute (frame , self , lenght - 1 , getItemNode .execute (storage , i ));
734
- self .setLenght ( lenght );
733
+ putValueNode .execute (frame , self , length - 1 , getItemNode .execute (storage , i ));
734
+ self .setLength ( length );
735
735
}
736
736
737
737
return PNone .NONE ;
@@ -744,7 +744,7 @@ Object extend(VirtualFrame frame, PArray self, Object value,
744
744
@ Cached GetNextNode nextNode ,
745
745
@ Cached IsBuiltinClassProfile errorProfile ) {
746
746
Object iter = lib .getIteratorWithFrame (value , frame );
747
- int lenght = self .getLength ();
747
+ int length = self .getLength ();
748
748
while (true ) {
749
749
Object nextValue ;
750
750
try {
@@ -756,14 +756,14 @@ Object extend(VirtualFrame frame, PArray self, Object value,
756
756
// The whole extend is not atomic, just individual inserts are. That's the same as
757
757
// in CPython
758
758
try {
759
- lenght = PythonUtils .addExact (lenght , 1 );
760
- self .ensureCapacity (lenght );
759
+ length = PythonUtils .addExact (length , 1 );
760
+ self .ensureCapacity (length );
761
761
} catch (OverflowException e ) {
762
762
CompilerDirectives .transferToInterpreterAndInvalidate ();
763
763
throw raise (MemoryError );
764
764
}
765
- putValueNode .execute (frame , self , lenght - 1 , nextValue );
766
- self .setLenght ( lenght );
765
+ putValueNode .execute (frame , self , length - 1 , nextValue );
766
+ self .setLength ( length );
767
767
}
768
768
769
769
return PNone .NONE ;
@@ -867,9 +867,9 @@ Object frombytes(PArray self, Object buffer,
867
867
if (bufferLength % itemsize != 0 ) {
868
868
throw raise (ValueError , "bytes length not a multiple of item size" );
869
869
}
870
- int newLenght = PythonUtils .addExact (oldSize , bufferLength / itemsize );
870
+ int newLength = PythonUtils .addExact (oldSize , bufferLength / itemsize );
871
871
byte [] bufferBytes = lib .getBufferBytes (buffer );
872
- self .resize (newLenght );
872
+ self .resize (newLength );
873
873
PythonUtils .arraycopy (bufferBytes , 0 , self .getBuffer (), oldSize * itemsize , bufferLength );
874
874
} catch (UnsupportedMessageException e ) {
875
875
throw CompilerDirectives .shouldNotReachHere ();
@@ -902,11 +902,11 @@ Object fromfile(VirtualFrame frame, PArray self, Object file, int n,
902
902
int nbytes = n * itemsize ;
903
903
Object readResult = lib .lookupAndCallRegularMethod (file , frame , "read" , nbytes );
904
904
if (readResult instanceof PBytes ) {
905
- int readLenght = lib .length (readResult );
905
+ int readLength = lib .length (readResult );
906
906
fromBytesNode .execute (frame , self , readResult );
907
907
// It would make more sense to check this before the frombytes call, but CPython
908
908
// does it this way
909
- if (readLenght != nbytes ) {
909
+ if (readLength != nbytes ) {
910
910
notEnoughBytesProfile .enter ();
911
911
throw raise (EOFError , "read() didn't return enough bytes" );
912
912
}
@@ -934,13 +934,13 @@ Object fromlist(VirtualFrame frame, PArray self, PList list,
934
934
@ Cached ArrayNodes .PutValueNode putValueNode ) {
935
935
try {
936
936
SequenceStorage storage = getSequenceStorageNode .execute (list );
937
- int lenght = lenNode .execute (storage );
938
- int newLength = PythonUtils .addExact (self .getLength (), lenght );
937
+ int length = lenNode .execute (storage );
938
+ int newLength = PythonUtils .addExact (self .getLength (), length );
939
939
self .ensureCapacity (newLength );
940
- for (int i = 0 ; i < lenght ; i ++) {
940
+ for (int i = 0 ; i < length ; i ++) {
941
941
putValueNode .execute (frame , self , self .getLength () + i , getItemScalarNode .execute (storage , i ));
942
942
}
943
- self .setLenght (newLength );
943
+ self .setLength (newLength );
944
944
return PNone .NONE ;
945
945
} catch (OverflowException e ) {
946
946
CompilerDirectives .transferToInterpreterAndInvalidate ();
@@ -986,16 +986,16 @@ abstract static class FromUnicodeNode extends PythonBinaryClinicBuiltinNode {
986
986
Object fromunicode (VirtualFrame frame , PArray self , String str ,
987
987
@ Cached ArrayNodes .PutValueNode putValueNode ) {
988
988
try {
989
- int lenght = PString .codePointCount (str , 0 , str .length ());
990
- int newLength = PythonUtils .addExact (self .getLength (), lenght );
989
+ int length = PString .codePointCount (str , 0 , str .length ());
990
+ int newLength = PythonUtils .addExact (self .getLength (), length );
991
991
self .ensureCapacity (newLength );
992
- for (int i = 0 , index = 0 ; i < lenght ; index ++) {
992
+ for (int i = 0 , index = 0 ; i < length ; index ++) {
993
993
int cpCount = PString .charCount (PString .codePointAt (str , i ));
994
994
String value = PString .substring (str , i , i + cpCount );
995
995
putValueNode .execute (frame , self , self .getLength () + index , value );
996
996
i += cpCount ;
997
997
}
998
- self .setLenght (newLength );
998
+ self .setLength (newLength );
999
999
return PNone .NONE ;
1000
1000
} catch (OverflowException e ) {
1001
1001
CompilerDirectives .transferToInterpreterAndInvalidate ();
0 commit comments