MRAB ha scritto:
I think you're right.
I have rewritten my code, a piece at a time, and (and this is very
annoying) now it works fine.
I really can't understand what went wrong with my old code.
Luca.
--
http://mail.python.org/mailman/listinfo/python-list
Mr.M wrote:
MRAB ha scritto:
Did you specify that the method accepts keywords arguments with
METH_KEYWORDS? The function would take parameters for the instance
(self), the positional arguments (args) and the keyword arguments
(kwargs).
http://docs.python.org/c-api/structures.html
If you don't
MRAB ha scritto:
Did you specify that the method accepts keywords arguments with
METH_KEYWORDS? The function would take parameters for the instance
(self), the positional arguments (args) and the keyword arguments
(kwargs).
http://docs.python.org/c-api/structures.html
If you don't use METH_KEY
Mr.M wrote:
Carl Banks ha scritto:
(some declarations omitted here)
You probably shouldn't have, that could be where the error is I'd
include the whole function up to the call that raises the exception.
Thank you so much Carl for your help, i'll provide more info so that you
can try to
Carl Banks ha scritto:
(some declarations omitted here)
You probably shouldn't have, that could be where the error is I'd
include the whole function up to the call that raises the exception.
Thank you so much Carl for your help, i'll provide more info so that you
can try to fix my errors
On Jan 22, 3:23 pm, "Mr.M" wrote:
> Hi,
>
> i can't understand what i'm doing wrong. I have a c/api that implements
> a new class.
> In (initproc) function i have somethink like this:
>
> [code]
>
> (some declarations omitted here)
You probably shouldn't have, that could be where the error is
En Sat, 19 Dec 2009 07:36:59 -0300, Emeka escribió:
Okay if that is the case, why do we need it? By having int a = 65, b =
66 ,
why should we also have *kwlist[]?
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
int a=65, b=66;
char *kwlist[] = {"a", "b", NULL}
My mistake seems to be that I declared
char a, b;
instead of
int a, b;
Thank you for sorting this out.
Joachim
--
http://mail.python.org/mailman/listinfo/python-list
Okay if that is the case, why do we need it? By having int a = 65, b = 66 ,
why should we also have *kwlist[]?
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
int a=65, b=66;
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC",
On Dec 18, 10:28 am, Joachim Dahl wrote:
> My mistake seems to be that I declared
>
> char a, b;
>
> instead of
>
> int a, b;
>
> Thank you for sorting this out.
>
> Joachim
I think you need to initialize them, too.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 18, 2009 at 7:57 AM, Emeka wrote:
> Case,
> Thanks so much! However, I am still confused. This is what I understood;
> foo (a = "a", b = "b") so function , foo, has default values which are "a"
> and "b". pointer kwlist[] is a way of specifying default values .
> Regards,
> Emeka
kwli
Case,
Thanks so much! However, I am still confused. This is what I understood;
foo (a = "a", b = "b") so function , foo, has default values which are "a"
and "b". pointer kwlist[] is a way of specifying default values .
Regards,
Emeka
On Fri, Dec 18, 2009 at 3:02 PM, Case Vanhorsen wrote:
>
On Fri, Dec 18, 2009 at 2:26 AM, Emeka wrote:
> char *kwlist[] = {"a", "b", NULL};
> if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
> &b))
> I am yet to understand what pointer kwlist[] does and why it is needed?
> Regards,
> Emeka
foo is designed to accept two arguments t
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b))
I am yet to understand what pointer kwlist[] does and why it is needed?
Regards,
Emeka
On Fri, Dec 18, 2009 at 8:17 AM, casevh wrote:
> On Dec 17, 11:14 am, Joachim Dahl wrote:
> > In
On Dec 17, 11:14 am, Joachim Dahl wrote:
> In the Ubuntu 9.10 version of Python 3.1 (using your patch), there's a
> related bug:
>
> >>> foo(b='b')
>
> will set the value of a in the extension module to zero, thus clearing
> whatever
> default value it may have had. In other words, the optional c
In the Ubuntu 9.10 version of Python 3.1 (using your patch), there's a
related bug:
>>> foo(b='b')
will set the value of a in the extension module to zero, thus clearing
whatever
default value it may have had. In other words, the optional character
arguments
that are skipped seem to be nulled by
thanks - the patch fixed my problem.
Joachim
On Dec 1, 5:51 am, casevh wrote:
> On Nov 30, 2:18 pm, Joachim Dahl wrote:
>
>
>
>
>
> > I think that "C" encoding is what I need, however I run into an odd
> > problem.
> > If I use the following C code
>
> > static PyObject* foo(PyObject *self, PyO
On Nov 30, 2:18 pm, Joachim Dahl wrote:
> I think that "C" encoding is what I need, however I run into an odd
> problem.
> If I use the following C code
>
> static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
> {
> char a, b;
> char *kwlist[] = {"a", "b", NULL};
> if (!PyAr
I think that "C" encoding is what I need, however I run into an odd
problem.
If I use the following C code
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
char a, b;
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b
On Nov 30, 1:04 pm, Joachim Dahl wrote:
> Obviously the name of the C function and the char variable cannot both
> be foo,
> so the C code should be:
>
> static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
> {
> char foochar;
> char *kwlist[] = {"foochar", NULL};
> if (!PyA
Obviously the name of the C function and the char variable cannot both
be foo,
so the C code should be:
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
char foochar;
char *kwlist[] = {"foochar", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "c", kwlist,
&foocha
21 matches
Mail list logo