[New-bugs-announce] [issue27111] redundant variables in long_add and long_sub

Oren Milman report at bugs.python.org
Tue May 24 16:43:24 EDT 2016

New submission from Oren Milman:

------------ the proposed changes ------------
In Objects/longobject.c in long_add and long_sub, the variables 'result' and 'r' (respectively), are used only once, and don't seem to make the code any clearer.

It seems the 'result' and 'r' variables were added in revision 40751. Back then, CONVERT_BINOP was used, and required calling Py_DECREF for a and b before returning.
Later on, in revision 43313, CONVERT_BINOP was removed, along with the calls to Py_DECREF it required, but the 'result' and 'r' variables were left untouched, and remained there to this day.

------------ diff ------------
The patches diff is attached.

------------ tests ------------
I built the patched CPython for x86, and played with it a little. Everything seemed to work as usual.

In addition, I ran 'python -m test' (on my 64-bit Windows 10) before and after applying the patch, and got quite the same output.
the outputs of both runs are attached.

components: Interpreter Core
files: proposedPatches.diff
keywords: patch
messages: 266271
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: redundant variables in long_add and long_sub
versions: Python 3.6
Added file: http://bugs.python.org/file42973/proposedPatches.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list