pidl: Fix the generation of py helper for 64 bit integer
authorMatthieu Patou <mat@matws.net>
Wed, 14 Apr 2010 20:18:46 +0000 (00:18 +0400)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 2 May 2010 13:59:49 +0000 (15:59 +0200)
Up to now the generation of code for python helpers dealing with 64 bits (NTTIME,hyper, ...)
was broken because they were assumed to be Int (PyInt_From ...) as Integer is always 32 bits
in python.
This fix use PyLong and states that the incomming data is a long long as it should be 64 bit at least.

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index 789a7dd87e3b67689d4ab86c35e331920fbe3656..226db078d6c39f12d2ffc2612c68e28de9173227 100644 (file)
@@ -961,7 +961,11 @@ sub ConvertScalarToPython($$$)
 
        $ctypename = expandAlias($ctypename);
 
-       if ($ctypename =~ /^(char|u?int[0-9]*|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+       if ($ctypename =~ /^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+               return "PyLong_FromLongLong($cvar)";
+       }
+
+       if ($ctypename =~ /^(char|u?int[0-9]*|time_t)$/) {
                return "PyInt_FromLong($cvar)";
        }