mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Moved get*doublearg() routines here from mathmodule.c
This commit is contained in:
parent
5b7f945bc3
commit
7a904edcbf
1 changed files with 29 additions and 0 deletions
|
@ -379,3 +379,32 @@ getshortlistarg(args, a, n)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
getdoublearg(args, px)
|
||||
register object *args;
|
||||
double *px;
|
||||
{
|
||||
if (args == NULL)
|
||||
return err_badarg();
|
||||
if (is_floatobject(args)) {
|
||||
*px = getfloatvalue(args);
|
||||
return 1;
|
||||
}
|
||||
if (is_intobject(args)) {
|
||||
*px = getintvalue(args);
|
||||
return 1;
|
||||
}
|
||||
return err_badarg();
|
||||
}
|
||||
|
||||
int
|
||||
get2doublearg(args, px, py)
|
||||
register object *args;
|
||||
double *px, *py;
|
||||
{
|
||||
if (args == NULL || !is_tupleobject(args) || gettuplesize(args) != 2)
|
||||
return err_badarg();
|
||||
return getdoublearg(gettupleitem(args, 0), px) &&
|
||||
getdoublearg(gettupleitem(args, 1), py);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue