gh-121153: Change _PyLong_CompactValue() return type to int#121536
gh-121153: Change _PyLong_CompactValue() return type to int#121536vstinner wants to merge 12 commits into
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This is incomplete change. You need also to change the code that calls _PyLong_CompactValue() (and simplify it).
|
When you're done making the requested changes, leave the comment: |
Ok, I updated _PyLong_CompactValue() usage as well. |
vstinner
left a comment
There was a problem hiding this comment.
@serhiy-storchaka: It would be nice if you could review this change since I'm not sure if it's correct.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
You need to update also other code. Take #121154 and replace Py_ssize_t with int. Then remove dead code.
| if (overflow == 0 && | ||
| (i_result >= 0 ? (b <= LONG_MAX - i_result) | ||
| : (b >= LONG_MIN - i_result))) | ||
| (i_result >= 0 ? (1 - i_result) : (1 - i_result))) |
There was a problem hiding this comment.
This code does not make sense.
There was a problem hiding this comment.
I don't understand this code.
There was a problem hiding this comment.
This is an overflow check for i_result += b.
I'm not sure that I'm not the right person to implement this change. Maybe you should create your own PR and I abandon this PR. |
|
This PR changes PyUnstable_Long_CompactValue() return type. I documented that change. If it's an issue, we can leave PyUnstable_Long_CompactValue() return type unchanged. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Yes, it needs also changing PyUnstable_Long_CompactValue which may be defined as an alias of _PyLong_CompactValue.
Technically, it now LGTM. But we should ask @markshannon what he thinks about changing the return type. Why it was Py_ssize_t at first place?
|
#121154 was merged instead. |
Uh oh!
There was an error while loading. Please reload this page.