| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| pub(crate) use method::PyMethod; | ||
| pub use setting::Settings; | ||
|
|
||
| pub const MAX_MEMORY_SIZE: usize = (usize::MAX >> 3) + 1; |
There was a problem hiding this comment.
Thank you! Is this constant came from CPython?
Sorry, something went wrong.
There was a problem hiding this comment.
Nah, I just copied it from the last PR. CPython seems to use max usize instead: https://github.com/python/cpython/blob/e0a41a5dd12cb6e9277b05abebac5c70be684dd7/Objects/listobject.c#L740, https://github.com/python/cpython/blob/e0a41a5dd12cb6e9277b05abebac5c70be684dd7/Include/pyport.h#L146
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
Updated to use isize::MAX. Also updated to include the size of the type and fixed the potential integer overflow problem.
Sorry, something went wrong.
|
Added @coolreader18 as a reviewer who reviewed #1779 |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, thanks for contributing!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #1750
Based on #1779 which seems to be abandoned.