[Cython] Out of order side effects of argument evaluation in function calls (ticket #654)

Stefan Behnel stefan_ml at behnel.de
Fri Mar 11 15:08:13 CET 2011

Vitja Makarov, 11.03.2011 15:04:
> 2011/3/11 Stefan Behnel:
>> Personally, I think it would be nice to keep up Python's semantics, but when
>> I implemented this I broke quite some code in Sage (you may have noticed
>> that the sage-build project in Hudson has been red for a while). There are
>> things in C and especially in C++ that cannot be easily copied into a
>> temporary variable in order to make sure they are evaluated before the
>> following arguments. This is not a problem for Python function calls where
>> all arguments end up being copied (and often converted) anyway. It is a
>> problem for C function calls, though.
>>     f(g(a), a.x, h(a))
> Why could not this be translated into:
> tmp1 = g(a)
> tmp2 = a.x
> tmp3 = h(a)
> f(tmp1, tmp2, tmp3)

See above.


More information about the cython-devel mailing list