FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159739: Propagate float rounding allocation failures by jelle-openai · Pull Request #160195 · python/cpython · GitHub

Repository navigation

gh-159739: Propagate float rounding allocation failures - #160195

Open
jelle-openai wants to merge 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-float-round-memory-error
Open

jelle-openai wants to merge 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-float-round-memory-error

Conversation

jelle-openai commented Oct 22, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

If the decimal-to-binary conversion inside round(float, ndigits) runs out of memory, it returns a -1.0 error sentinel and sets errno to ENOMEM. Ignoring that error can return -1.0 as a seemingly successful rounded value. Raise MemoryError instead. Backport to 3.15 and 3.14.

If the decimal-to-binary conversion inside round(float, ndigits) runs out of memory, it returns a -1.0 error sentinel and sets errno to ENOMEM. Ignoring that error can return -1.0 as a seemingly successful rounded value. Raise MemoryError instead. Backport to 3.15 and 3.14.
Comment thread Objects/floatobject.c
_Py_SET_53BIT_PRECISION_END;
if (errno == ERANGE && fabs(rounded) >= 1.)
if (errno == ENOMEM)
PyErr_NoMemory();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we follow PEP 7 please?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL