diff options
author | Disconnect3d <dominik.b.czarnota@gmail.com> | 2019-07-11 21:57:42 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-07-11 21:57:42 (GMT) |
commit | 13ab570febac64bb55fb46d866a9ba5a46ab8902 (patch) | |
tree | 130c70fc7a1827f91db26cc5ed2fbefb4031f404 /install-sh | |
parent | 4737265622251756a9480ab84af2442b6b986850 (diff) | |
download | cpython-13ab570febac64bb55fb46d866a9ba5a46ab8902.zip cpython-13ab570febac64bb55fb46d866a9ba5a46ab8902.tar.gz cpython-13ab570febac64bb55fb46d866a9ba5a46ab8902.tar.bz2 |
Remove redundant check from arraymodule b_getitem (GH-14676)
The `arraymodule`'s `b_getitem` function returns a `PyLong` converted
from `arrayobject`'s array, by dereferencing a pointer to `char`.
When the `char` type is `signed char`, the `if (x >= 128) x -= 256;` comparison/code is redundant because a `signed char` will have a value of `[-128, 127]` and so `x` will never be greater or equal than 128.
This check was indeed needed for situations where a given compiler would assume `char` being `unsigned char` which would make `x` in `[0, 256]` range.
However, the check can be removed if we cast the `ob_item` into a signed char pointer (`signed char*`) instead of `char*`.
This PR/commit introduces this change.
Diffstat (limited to 'install-sh')
0 files changed, 0 insertions, 0 deletions