This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: redundant variables in long_add and long_sub
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: Oren Milman, mark.dickinson, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-05-24 20:43 by Oren Milman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
proposedPatches.diff Oren Milman, 2016-05-24 20:43 proposed patches diff file review
patchedCPythonTestOutput.txt Oren Milman, 2016-05-24 20:43 test output of CPython with my patches (tested on my PC)
CPythonTestOutput.txt Oren Milman, 2016-05-24 20:44 test output of CPython without my patches (tested on my PC)
Messages (5)
msg266271 - (view) Author: Oren Milman (Oren Milman) * Date: 2016-05-24 20:43
------------ 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.
msg267443 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-05 17:44
Oren, could you please sign a Contributor Licensing Agreement?

http://www.python.org/psf/contrib/contrib-form/
http://www.python.org/psf/contrib/
msg267448 - (view) Author: Oren Milman (Oren Milman) * Date: 2016-06-05 18:05
done.
By the way, I am logging in to bugs.python.org through accounts.google.com, but I couldn't see any way to do the same in www.python.org, so I have a native account there (with the same email address). I hope that won't be an issue...
msg276817 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-17 19:02
New changeset 0e585bce0bb1 by Mark Dickinson in branch 'default':
Issue #27111: Minor simplication to long_add and long_sub fast path code. Thanks Oren Milman.
https://hg.python.org/cpython/rev/0e585bce0bb1
msg276818 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-09-17 19:03
Applied; thanks. (I left the braces in, following PEP 7 ("braces are strongly preferred").
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71298
2016-09-17 19:03:57mark.dickinsonsetassignee: mark.dickinson
2016-09-17 19:03:48mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg276818

resolution: fixed
stage: patch review -> resolved
2016-09-17 19:02:09python-devsetnosy: + python-dev
messages: + msg276817
2016-09-13 14:04:49Oren Milmansetversions: + Python 3.7, - Python 3.6
2016-06-05 18:05:55Oren Milmansetmessages: + msg267448
2016-06-05 17:44:16serhiy.storchakasetmessages: + msg267443
2016-05-25 03:55:07serhiy.storchakasetnosy: + serhiy.storchaka

stage: patch review
2016-05-24 20:44:27Oren Milmansetfiles: + CPythonTestOutput.txt
2016-05-24 20:43:59Oren Milmansetfiles: + patchedCPythonTestOutput.txt
2016-05-24 20:43:24Oren Milmancreate