Repository navigation
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
There are other places, that might be changed, especially in longobject.c: I suggest you first create an issue. |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Do not merge until there are solid evidences of the speed up.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
@serhiy-storchaka, why do you suspect speed regressions at all? PyLong_FromLong() will run more complex versions of _PyLong_GetZero/One anyway. Lines 309 to 317 in 5dac0dc Lines 56 to 61 in 5dac0dc cpython/Include/internal/pycore_long.h Lines 66 to 74 in 5dac0dc |
|
@serhiy-storchaka I'm inspired by #125044 and I found that there are other places using At least the 2 null checks below should be removed. They're unreachable. Lines 1564 to 1566 in 5dac0dc Lines 5006 to 5008 in 5dac0dc |
|
@hikariyo, all similar checks are unreachable now. But that's might be viewed as internal detail of the PyLong_FromLong() implementation. |
|
I suspect no difference at all. This is a pure cosmetic change. On other hand, it replaces public functions calls with private functions calls. So, this is a cosmetic change that makes the code more ugly. |
However _PyLong_GetZero/One must return non-null values, so using them can avoid this problem. |
But _PyLong_GetZero/One do widely used in current code. Shouldn't we unify the usages? |
|
They were introduced (first as simple global variables) for the cases when you need a borrowed reference to integers 0 or 1. Closing this PR as pure cosmetic change. |
Simply reduces a null check as
_PyLong_GetOne()cannot fail.