A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/070900.html below:

[Python-Dev] Why is nb_inplace_power ternary?

[Python-Dev] Why is nb_inplace_power ternary? [Python-Dev] Why is nb_inplace_power ternary?Raymond Hettinger python at rcn.com
Fri Feb 9 06:30:05 CET 2007
[MvL]
>>>>> 1. For 2.5.1, rewrite slot_nb_inplace_power to raise an exception
>>>>> if the third argument is not None, and then invoke __ipow__ with only one 
>>>>> argument.

[Raymond]
>> Why would you change Py2.5?  There is no bug here.

[MvL]
> There is: slot_nb_inplace has the signature
>
> static PyObject * slot_nb_inplace_power(PyObject *self, PyObject * arg1)
>
> yet it is stored in as_number.nb_inplace_power, which is defined as
>
> typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *);
> ternaryfunc nb_inplace_power;
>
> This has undefined behavior. Even if it had, slot_nb_inplace_power
> would silently discard its third argument.

That made sense, but my question was whether there would be benefit
to making the change in the middle of a major release.  At worst, code that is
currently working due to undefined behavior will stop working.   I don't
see any offsetting benefit.  ISTM that Py2.5 should be left as-is and that
the full signature change be made in Py2.6.


Raymond

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4