File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
com.oracle.graal.python.test/src/tests/unittest_tags
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 67
67
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_replace
68
68
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_replace_id
69
69
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_replace_overflow
70
+ *graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_repr
70
71
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_resize
71
72
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_rfind
72
73
*graalpython.lib-python.3.test.test_unicode.UnicodeTest.test_rindex
Original file line number Diff line number Diff line change @@ -1851,7 +1851,7 @@ static boolean doGeneric(Object self,
1851
1851
abstract static class IsPrintableNode extends PythonUnaryBuiltinNode {
1852
1852
@ TruffleBoundary
1853
1853
private static boolean isPrintableChar (int i ) {
1854
- return UCharacter .isPrintable (i );
1854
+ return StringUtils .isPrintable (i );
1855
1855
}
1856
1856
1857
1857
@ Specialization
Original file line number Diff line number Diff line change 45
45
import org .graalvm .nativeimage .ImageInfo ;
46
46
47
47
import com .ibm .icu .lang .UCharacter ;
48
+ import com .ibm .icu .lang .UCharacterCategory ;
48
49
import com .ibm .icu .lang .UProperty ;
49
50
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
50
51
@@ -242,7 +243,22 @@ public static boolean isPrintable(int codepoint) {
242
243
243
244
@ TruffleBoundary
244
245
private static boolean isPrintableICU (int codepoint ) {
245
- return UCharacter .isPrintable (codepoint );
246
+ // ICU's definition of printability is different from CPython, so we cannot use
247
+ // UCharacter.isPrintable
248
+ int category = UCharacter .getType (codepoint );
249
+ switch (category ) {
250
+ case UCharacterCategory .CONTROL :
251
+ case UCharacterCategory .FORMAT :
252
+ case UCharacterCategory .SURROGATE :
253
+ case UCharacterCategory .PRIVATE_USE :
254
+ case UCharacterCategory .UNASSIGNED :
255
+ case UCharacterCategory .LINE_SEPARATOR :
256
+ case UCharacterCategory .PARAGRAPH_SEPARATOR :
257
+ return false ;
258
+ case UCharacterCategory .SPACE_SEPARATOR :
259
+ return codepoint == ' ' ;
260
+ }
261
+ return true ;
246
262
}
247
263
248
264
@ TruffleBoundary
You can’t perform that action at this time.
0 commit comments