Skip to content

gh-120950: Fix overflow in math.log() with large int-like argument #121011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 25, 2024

Handling of arbitrary large int-like argument is now consistent with handling arbitrary large int arguments.

Handling of arbitrary large int-like argument is now consistent with
handling arbitrary large int arguments.
@serhiy-storchaka
Copy link
Member Author

This is not optimal, because for large int-like argument __index__ is called twice and OverflowError is raised and silenced twice.

@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review June 26, 2024 13:37
Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

Copy link
Contributor

@skirpichev skirpichev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this pr has conflicts (which seems to be easy to fix, however).

Lets merge this; it has approval from Mark. LGTM with one cleanup, as _PyLong_Frexp() now not raises.

Comment on lines 2241 to 2242
if (x == -1.0 && PyErr_Occurred())
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (x == -1.0 && PyErr_Occurred())
return NULL;

Now _PyLong_Frexp() not raises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants