Skip to content

Commit c01a324

Browse files
committed
fix native string subclass construction without argument
1 parent 674a556 commit c01a324

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,11 @@ static Object doNativeSubclass(VirtualFrame frame, Object cls, Object obj, @Supp
22192219
@Cached @SuppressWarnings("unused") IsSubtypeNode isSubtype,
22202220
@Shared @Cached PyObjectStrAsObjectNode strNode,
22212221
@Cached CExtNodes.StringSubtypeNew subtypeNew) {
2222-
return subtypeNew.call(cls, strNode.execute(frame, obj));
2222+
if (obj == PNone.NO_VALUE) {
2223+
return subtypeNew.call(cls, T_EMPTY_STRING);
2224+
} else {
2225+
return subtypeNew.call(cls, strNode.execute(frame, obj));
2226+
}
22232227
}
22242228

22252229
protected static boolean isSubtypeOfString(VirtualFrame frame, IsSubtypeNode isSubtypeNode, Object cls) {

0 commit comments

Comments
 (0)