@@ -2707,12 +2707,12 @@ protected boolean checkBase(int base) {
2707
2707
public abstract static class PySequenceTupleNode extends PythonUnaryBuiltinNode {
2708
2708
@ Specialization (guards = "isTuple(obj, getClassNode)" )
2709
2709
public PTuple values (PTuple obj ,
2710
- @ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ) {
2710
+ @ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ) {
2711
2711
return obj ;
2712
2712
}
2713
2713
2714
2714
@ Specialization (guards = "!isTuple(obj, getClassNode)" )
2715
- public Object values (VirtualFrame frame , Object obj ,
2715
+ public Object values (VirtualFrame frame , Object obj ,
2716
2716
@ Cached TupleNode tupleNode ,
2717
2717
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
2718
2718
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -2724,7 +2724,7 @@ public Object values(VirtualFrame frame, Object obj,
2724
2724
return getNativeNullNode .execute ();
2725
2725
}
2726
2726
}
2727
-
2727
+
2728
2728
protected boolean isTuple (Object obj , GetClassNode getClassNode ) {
2729
2729
return getClassNode .execute (obj ) == PythonBuiltinClassType .PTuple ;
2730
2730
}
@@ -3010,12 +3010,13 @@ public String fromObject(String s) {
3010
3010
return s ;
3011
3011
}
3012
3012
3013
- @ Specialization
3014
- public PString fromObject (PString s ) {
3013
+ @ Specialization (guards = "isPStringType(s, getClassNode)" )
3014
+ public PString fromObject (PString s ,
3015
+ @ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ) {
3015
3016
return s ;
3016
3017
}
3017
3018
3018
- @ Specialization (guards = {"!isString (obj)" , "isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3019
+ @ Specialization (guards = {"!isPStringType (obj, getClassNode )" , "isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3019
3020
public Object fromObject (VirtualFrame frame , Object obj ,
3020
3021
@ Cached StrNode strNode ,
3021
3022
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
@@ -3030,7 +3031,7 @@ public Object fromObject(VirtualFrame frame, Object obj,
3030
3031
}
3031
3032
}
3032
3033
3033
- @ Specialization (guards = {"!isString(obj)" , "! isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3034
+ @ Specialization (guards = {"!isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3034
3035
public Object fromObject (VirtualFrame frame , Object obj ,
3035
3036
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
3036
3037
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
@@ -3042,6 +3043,10 @@ public Object fromObject(VirtualFrame frame, Object obj,
3042
3043
protected boolean isStringSubtype (VirtualFrame frame , Object obj , GetClassNode getClassNode , IsSubtypeNode isSubtypeNode ) {
3043
3044
return isSubtypeNode .execute (frame , getClassNode .execute (obj ), PythonBuiltinClassType .PString );
3044
3045
}
3046
+
3047
+ protected boolean isPStringType (Object obj , GetClassNode getClassNode ) {
3048
+ return getClassNode .execute (obj ) == PythonBuiltinClassType .PString ;
3049
+ }
3045
3050
}
3046
3051
3047
3052
@ Builtin (name = "PyUnicode_GetLength" , minNumOfPositionalArgs = 1 )
0 commit comments