On Thu, Jun 5, 2008 at 11:18 PM, Alexandre Vassalotti
<[EMAIL PROTECTED]> wrote:
> On Thu, Jun 5, 2008 at 10:14 PM, Mark Hammond <[EMAIL PROTECTED]> wrote:
>> Set an error if the 'arg' tuple doesn't have a length of zero?
>>
>
> Oh, that isn't a bad idea at all. I will try this. Thanks!
>
Worked flawlessly!
Just for the archives, here's how it looks like:
static int
Unpickler_init(UnpicklerObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"file", "encoding", "errors", 0};
PyObject *file;
char *encoding = NULL;
char *errors = NULL;
if (Py_SIZE(args) != 1) {
PyErr_Format(PyExc_TypeError,
"%s takes exactly one 1 positional argument (%zd given)",
Py_TYPE(self)->tp_name, Py_SIZE(args));
return -1;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ss:Unpickler", kwlist,
&file, &encoding, &errors))
return -1;
...
Thank you, Mark, for the tip!
-- Alexandre
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com