Handle MemoryError for sequences by crazymerlyn · Pull Request #5418 · RustPython/RustPython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Is this constant came from CPython?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use isize::MAX. Also updated to include the size of the type and fixed the potential integer overflow problem.