Running into a problem with PyArg_ParseTuple ...

Richard Sharpe realrichardsharpe at gmail.com
Sun Mar 25 16:20:06 MDT 2012


On Sun, Mar 25, 2012 at 2:15 PM, Jelmer Vernooij <jelmer at samba.org> wrote:
> On Sun, Mar 25, 2012 at 10:31:42AM -0700, Richard Sharpe wrote:
>> Hi folks,
>
>> I have tried to modify py_smb_getacl thusly:
>
>> -static PyObject *py_smb_getacl(pytalloc_Object *self, PyObject *args, PyObject
>> +static PyObject *py_smb_getacl(pytalloc_Object *self, PyObject *args)
>>  {
> ^^ What kind of change is this? It seems like the line isn't wrapped
> properly?

It was a cut-n-paste issue. It compiles, otherwise I wouldn't get a crash :-)

>>         NTSTATUS status;
>>         union smb_open io;
>>         union smb_fileinfo fio;
>>         struct smb_private_data *spdata;
>>         const char *filename;
>> +       int sinfo = 0;
>>         int fnum;
>
>> -       if (!PyArg_ParseTuple(args, "s:get_acl", &filename)) {
>> +       if (!PyArg_ParseTuple(args, "sl:get_acl", &filename, &sinfo)) {
>>                 return NULL;
>>         }
> You want "si" here rather than "sl" if sinfo is an "int".

Well, it is an int, but l is for long int, which I might have
mistakenly thought was the same as int on ix86_64 and i686 ... maybe
not. I will give it a try to see if it resolves my problem.

> See also http://docs.python.org/c-api/arg.html
>
> Cheers,
>
> Jelmer
>



-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list