PyArg_NoArgs / PyArg_Parse API

Benoit Dupire bdupire at seatech.fau.edu
Sat Jul 8 18:24:04 EDT 2000


PyArgs_NoArg(args) is an API function, used in timemodule.c and not
referenced in the documentation..

Actually, it's defined as a macro in Python.h
and is equivalent to PyArg_Parse(args,"")

I didn't see Py_ArgParse in the doc either!

It 's not too difficult too imagine what is the role of PyArg_NoArgs ;-)

But when I want to use it in the same way and when I link the C module
statically:

static PyObject * test_getstruct(PyObject * self, PyObject * args)
{

 if (!PyArg_NoArgs(args))
  return NULL;
 return PyString_FromString(example);   /* example=global variable*/
}


and when i type
>>> import test_API
>>> test_API.getstruct()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: function requires no arguments

 (I work on Python 1.5.2 on QNX). Someone can explain me this error?
It would be nice to add a little something about that in the online doc.

Thanks a lot!

Benoit









More information about the Python-list mailing list