Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a904ed

Browse files
committed
Moved get*doublearg() routines here from mathmodule.c
1 parent 5b7f945 commit 7a904ed

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Python/modsupport.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,32 @@ getshortlistarg(args, a, n)
379379
}
380380
return 1;
381381
}
382+
383+
int
384+
getdoublearg(args, px)
385+
register object *args;
386+
double *px;
387+
{
388+
if (args == NULL)
389+
return err_badarg();
390+
if (is_floatobject(args)) {
391+
*px = getfloatvalue(args);
392+
return 1;
393+
}
394+
if (is_intobject(args)) {
395+
*px = getintvalue(args);
396+
return 1;
397+
}
398+
return err_badarg();
399+
}
400+
401+
int
402+
get2doublearg(args, px, py)
403+
register object *args;
404+
double *px, *py;
405+
{
406+
if (args == NULL || !is_tupleobject(args) || gettuplesize(args) != 2)
407+
return err_badarg();
408+
return getdoublearg(gettupleitem(args, 0), px) &&
409+
getdoublearg(gettupleitem(args, 1), py);
410+
}

0 commit comments

Comments
 (0)