Dealing more nicely with int when working with long in python
Matthieu Patou
mat at samba.org
Mon Jun 21 23:56:35 MDT 2010
Hi Jelmer,
So following our talk I have the impression that we should change this
in the pidl:
if (expandAlias($actual_ctype->{NAME}) =~
/^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
$self->pidl("PY_CHECK_TYPE(&PyLong_Type, $cvar,
$fail);");
$self->pidl("$target = PyLong_AsLongLong($cvar);");
return;
}
to:
if (expandAlias($actual_ctype->{NAME}) =~
/^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
$self->pidl("PY_CHECK_TYPE2(&PyLong_Type,
&PyInt_Type, $cvar, $fail);");
$self->pidl("$target =
PyLong_AsUnsignedLongLongMask($cvar);");
return;
}
Where PY_CHECK_TYPE2 will do almost the same at the PY_CHECK_TYPE but
with 2 type verification (if not type1 and not type2 then error).
Matthieu
--
Matthieu Patou
Samba Team http://samba.org
More information about the samba-technical
mailing list