[Cython] "__ipow__ has wrong number of arguments" is back here

Robert Bradshaw robertwb at math.washington.edu
Thu Mar 3 22:05:19 CET 2011


On Wed, Mar 2, 2011 at 5:47 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> On 2 March 2011 17:14, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>> On 2 March 2011 16:18, Vitja Makarov <vitja.makarov at gmail.com> wrote:
>>> Hi!
>>>
>>> I noticed that this error came back again.
>>>
>>> https://sage.math.washington.edu:8091/hudson/view/cython-devel/job/cython-devel-tests-py26-c/lastCompletedBuild/testReport/(root)/CythonRunTestCase/compiling__c__and_running_special_methods_T561/
>>>
>>
>> I've pushed a fix for __ipow__ to take just two arguments, like
>> regular Python classes.
>> https://github.com/cython/cython/commit/490fc80e6b494f8ed65f78fc2032d856ec75b8ef
>>
>> But I forgot to update test for ticket #561, now this should fixed:
>> https://github.com/cython/cython/commit/829d6485b77b5688671959f840712c01e6886556
>>
>
> BTW, do you all agree with this change?

To summarize, the C signature of ipow takes three arguments, but the
third is often/always garbage, so we shouldn't use it?

> I expect this change to break some code, particularly in Sage...

It'll be a compile time error fixing a potential runtime crash, so I
think that's a good move. Unfortunately the sage-build is still broken
due to the fixes for http://trac.cython.org/cython_trac/ticket/654 ,
but I doubt we use ipow much for two reasons: firstly, most of our
objects are immutable, and secondly rather than taking a "modulus" as
a third argument for power, the way to do this is to power an element
of the appropriate ring, e.g. mod(2, 17)*1000.

- Robert


More information about the cython-devel mailing list