Problem using new Python type: "cannot add type to string"
Janet
zptang at hotmail.com
Fri Sep 21 21:55:24 EDT 2001
More information about the Python-list mailing list
Fri Sep 21 21:55:24 EDT 2001
- Previous message (by thread): How to configure and install Python
- Next message (by thread): Problem using new Python type: "cannot add type to string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I created a new Python type (extension in C), and tried to call a function with an object of the new type as the argument: PyObject *arglist = PyTuple_New(1); PyTuple_SetItem(arglist, 0, myObj); /* myObj is an object of the new type */ PyObject_CallObject(funcObj, arglist);... However, the PyObject_CallObject() failed with the error message saying that: "cannot add type <my new type name> to string". It seems that the error was generated when string_concat() in Objects/stringobject.c is invoked. The function tested on the type of the second argument and outputted error whenever the argument is not a PyStringObject. I would like to know why does this problem appear. Is there any methods in the new type that I forgot to implement? (BTW, I did implemented the tp_str, tp_repr, and tp_print in my new type). Thanks
- Previous message (by thread): How to configure and install Python
- Next message (by thread): Problem using new Python type: "cannot add type to string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list