C extension type gives type error in power operator

2008-11-20 Thread Paul Moore
I'm trying to implement an extension type with a power operator. The operator is unusual in that I want to allow my objects to be raised to an integer power: p = Pattern() p3 = p ** 3 I've implemented the code for a nb_power slot, it converts the other argument to a C long using

Re: C extension type gives type error in power operator

2008-11-20 Thread Thomas Heller
Paul Moore schrieb: I'm trying to implement an extension type with a power operator. The operator is unusual in that I want to allow my objects to be raised to an integer power: p = Pattern() p3 = p ** 3 I've implemented the code for a nb_power slot, it converts the other argument

Re: C extension type gives type error in power operator

2008-11-20 Thread Paul Moore
On 20 Nov, 15:43, Thomas Heller [EMAIL PROTECTED] wrote: Paul Moore schrieb: However, when I try to use the operator, I get the following error: TypeError: unsupported operand type(s) for ** or pow(): '_ppeg.Pattern' and 'int' Try to set Py_TPFLAGS_CHECKTYPES in your extension type (in