Skip to content

Commit 93cb8a6

Browse files
committed
Fix swapped surrogates in backwards iteration
1 parent 8c4c543 commit 93cb8a6

File tree

1 file changed

+3
-3
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str

1 file changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,15 +1214,15 @@ private PList rsplitfields(VirtualFrame frame, String s, int maxsplit, AppendNod
12141214
int start = 0, end = length, splits = 0;
12151215

12161216
for (int i = length - 1; i >= 0; i--) {
1217-
if (!PString.isHighSurrogate(s.charAt(i))) {
1217+
if (!PString.isLowSurrogate(s.charAt(i))) {
12181218
if (StringUtils.isSpace(PString.codePointAt(s, i))) {
12191219
if (hasSegment) {
12201220
appendNode.execute(list, s.substring(start, end));
12211221
hasSegment = false;
12221222
splits++;
12231223
}
12241224
end = i;
1225-
if (PString.isLowSurrogate(s.charAt(i))) {
1225+
if (PString.isHighSurrogate(s.charAt(i))) {
12261226
end++;
12271227
}
12281228
} else {
@@ -2299,7 +2299,7 @@ static String doString(String self) {
22992299
private static void handleCapitalSigma(String self, StringBuilder sb, int i, int codePoint) {
23002300
int j;
23012301
for (j = i - 1; j >= 0; j--) {
2302-
if (!Character.isHighSurrogate(self.charAt(j))) {
2302+
if (!Character.isLowSurrogate(self.charAt(j))) {
23032303
int ch = self.codePointAt(j);
23042304
if (!UCharacter.hasBinaryProperty(ch, UProperty.CASE_IGNORABLE)) {
23052305
break;

0 commit comments

Comments
 (0)