Running into a problem with PyArg_ParseTuple ...
Richard Sharpe
realrichardsharpe at gmail.com
Sun Mar 25 16:43:08 MDT 2012
2012/3/25 Richard Sharpe <realrichardsharpe at gmail.com>:
> 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.
Sigh. That was the problem.
I have a good short-term solution, however, I think that long-term
those arguments need to be optional, because I suspect that there is
working code out there using the current forms.
--
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
More information about the samba-technical
mailing list