39
39
40
40
import com .oracle .graal .python .builtins .Builtin ;
41
41
import com .oracle .graal .python .builtins .CoreFunctions ;
42
+ import com .oracle .graal .python .builtins .PythonBuiltinClassType ;
42
43
import com .oracle .graal .python .builtins .PythonBuiltins ;
43
44
import com .oracle .graal .python .builtins .objects .PNone ;
44
45
import com .oracle .graal .python .builtins .objects .common .SequenceStorageNodes ;
@@ -1984,9 +1985,12 @@ public Object varArgExecute(VirtualFrame frame, Object self, Object[] arguments,
1984
1985
}
1985
1986
1986
1987
@ Specialization (guards = "arguments.length == 2" )
1987
- public double hypot2 (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object self , Object [] arguments , @ SuppressWarnings ( "unused" ) PKeyword [] keywords ,
1988
+ public double hypot2 (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object self , Object [] arguments , PKeyword [] keywords ,
1988
1989
@ Cached ("create()" ) CastToDoubleNode xCastNode ,
1989
1990
@ Cached ("create()" ) CastToDoubleNode yCastNode ) {
1991
+ if (keywords .length != 0 ) {
1992
+ throw raise (PythonBuiltinClassType .TypeError , "hypot() takes no keyword arguments" );
1993
+ }
1990
1994
double x = xCastNode .execute (frame , arguments [0 ]);
1991
1995
double y = yCastNode .execute (frame , arguments [1 ]);
1992
1996
double result = Math .hypot (x , y );
@@ -1997,8 +2001,11 @@ public double hypot2(VirtualFrame frame, @SuppressWarnings("unused") Object self
1997
2001
}
1998
2002
1999
2003
@ Specialization
2000
- public double hypotGeneric (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object self , Object [] arguments , @ SuppressWarnings ( "unused" ) PKeyword [] keywords ,
2004
+ public double hypotGeneric (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object self , Object [] arguments , PKeyword [] keywords ,
2001
2005
@ Cached ("create()" ) CastToDoubleNode castNode ) {
2006
+ if (keywords .length != 0 ) {
2007
+ throw raise (PythonBuiltinClassType .TypeError , "hypot() takes no keyword arguments" );
2008
+ }
2002
2009
double max = 0.0 ;
2003
2010
boolean foundNan = false ;
2004
2011
double [] coordinates = new double [arguments .length ];
0 commit comments