Skip to content

Commit adbbdc8

Browse files
committed
_socket builtin: add isNoValue guards on default args
- style fix
1 parent 847bc3f commit adbbdc8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,23 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
7070
@Builtin(name = "socket", minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 5, keywordArguments = {"family", "type", "proto", "fileno"}, constructsClass = PythonBuiltinClassType.PSocket)
7171
@GenerateNodeFactory
7272
public abstract static class SocketNode extends PythonBuiltinNode {
73-
@Specialization
74-
Object socket(PythonClass cls, @SuppressWarnings("unused") PNone family, @SuppressWarnings("unused") PNone type, @SuppressWarnings("unused") PNone proto, @SuppressWarnings("unused") PNone fileno) {
73+
@Specialization(guards = {"isNoValue(family)", "isNoValue(type)", "isNoValue(proto)", "isNoValue(fileno)"})
74+
Object socket(PythonClass cls, @SuppressWarnings("unused") PNone family, @SuppressWarnings("unused") PNone type, @SuppressWarnings("unused") PNone proto,
75+
@SuppressWarnings("unused") PNone fileno) {
7576
return createSocketInternal(cls, PSocket.AF_INET, PSocket.SOCK_STREAM, 0);
7677
}
7778

78-
@Specialization
79+
@Specialization(guards = {"isNoValue(type)", "isNoValue(proto)", "isNoValue(fileno)"})
7980
Object socket(PythonClass cls, int family, @SuppressWarnings("unused") PNone type, @SuppressWarnings("unused") PNone proto, @SuppressWarnings("unused") PNone fileno) {
8081
return createSocketInternal(cls, family, PSocket.SOCK_STREAM, 0);
8182
}
8283

83-
@Specialization
84+
@Specialization(guards = {"isNoValue(proto)", "isNoValue(fileno)"})
8485
Object socket(PythonClass cls, int family, int type, @SuppressWarnings("unused") PNone proto, @SuppressWarnings("unused") PNone fileno) {
8586
return createSocketInternal(cls, family, type, 0);
8687
}
8788

88-
@Specialization
89+
@Specialization(guards = {"isNoValue(fileno)"})
8990
Object socket(PythonClass cls, int family, int type, int proto, @SuppressWarnings("unused") PNone fileno) {
9091
return createSocketInternal(cls, family, type, proto);
9192
}

0 commit comments

Comments
 (0)