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

Handle MemoryError for sequences by crazymerlyn · Pull Request #5418 · RustPython/RustPython · GitHub

Handle MemoryError for sequences - #5418

Merged
coolreader18 merged 1 commit into
RustPython:mainfrom
crazymerlyn:memoryerror
Sep 29, 2024
Merged

Handle MemoryError for sequences#5418
coolreader18 merged 1 commit into
RustPython:mainfrom
crazymerlyn:memoryerror

Conversation

Copy link
Copy Markdown
Contributor

Fixes #1750

Based on #1779 which seems to be abandoned.

Comment thread vm/src/vm/mod.rs Outdated
pub(crate) use method::PyMethod;
pub use setting::Settings;

pub const MAX_MEMORY_SIZE: usize = (usize::MAX >> 3) + 1;

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

Thank you! Is this constant came from CPython?

Copy link
Copy Markdown
Contributor Author

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

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

That looks like isize::MAX, since the first s in ssize_t means signed. Which makes sense, since that's the max size an allocation can be for LLVM. I do think we could maybe just use isize::MAX, because otherwise we're unnecessarily constraining allocation size to "just" 512GiB on 32-bit systems.

Copy link
Copy Markdown
Contributor Author

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

Updated to use isize::MAX. Also updated to include the size of the type and fixed the potential integer overflow problem.

Copy link
Copy Markdown
Member

Added @coolreader18 as a reviewer who reviewed #1779

crazymerlyn force-pushed the memoryerror branch 2 times, most recently from 75a03e3 to cf9f036 Compare September 29, 2024 15:20

coolreader18 left a comment

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

LGTM, thanks for contributing!

coolreader18 merged commit 29d9534 into RustPython:main Sep 29, 2024
crazymerlyn deleted the memoryerror branch September 29, 2024 15:57
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list panic when size > isize::MAX

3 participants


Back | FazBrowse Home | New Git URL