Message277371
------------ current state ------------
In Objects/longobject.c, the function maybe_small_long first checks whether v (the received PyLongObject pointer) is not NULL.
However, currently in every call to maybe_small_long, it is already guaranteed that v is not NULL, which makes that check redundant.
(Currently, the following are the only functions that call maybe_small_long:
* PyLong_FromString
* long_divrem
* long_rshift
* long_lshift
* long_bitwise)
With regard to relevant changes made in the past, maybe_small_long remained quite the same since it was added, in changeset 48567 (https://hg.python.org/cpython/rev/1ce7e5c5a761) - in particular, the check (whether v is not NULL) was always there.
When it was added, both long_rshift and long_lshift might have called maybe_small_long with v as NULL, which seems like the reason for adding the check back then.
------------ proposed changes ------------
In Objects/longobject.c in maybe_small_long, remove the check whether v is not NULL, and add an 'assert(v != NULL);'.
------------ diff ------------
The proposed patches diff file is attached.
------------ tests ------------
I ran 'python_d.exe -m test -j3' (on my 64-bit Windows 10) with and without the patches, and got quite the same output.
The outputs of both runs are attached. |
|
Date |
User |
Action |
Args |
2016-09-25 12:38:54 | Oren Milman | set | recipients:
+ Oren Milman |
2016-09-25 12:38:49 | Oren Milman | set | messageid: <1474807129.82.0.382884780028.issue28272@psf.upfronthosting.co.za> |
2016-09-25 12:38:49 | Oren Milman | link | issue28272 messages |
2016-09-25 12:38:49 | Oren Milman | create | |
|