On Posix platforms without mremap() (FreeBSD, OpenBSD, NetBSD, OpenIndiana) mmap.resize() raises SystemError.
SystemError: mmap: resizing not available--no mremap()
SystemError should only be raised in case of the misuse of the C API or breaking internal consistency of the Python core. It is one step away from a segmentation fault or undefined behavior. If some function cannot be implemented, it should either do not exist (causing AttributeError) or raise more appropriate exception when called, like NotImplemenedError, or OSError(ENOTSUP), or simply RuntimeError.
I'd like to just remove the method on platforms which doesn't support it for consistent reasons, just like the madvise method is not exist on platforms which doesn't support it.
Activity
YvesDup commented on Aug 27, 2025
This also happens on MacOSX 15.1, M4 pro
serhiy-storchaka commented on Aug 28, 2025
There was other improper use of SystemError in the mmap module: #7381.
aisk commented on Aug 31, 2025
I'd like to just remove the method on platforms which doesn't support it for consistent reasons, just like the madvise method is not exist on platforms which doesn't support it.
gh-138205: Remove the `resize` method on `mmap` object on platforms d…
serhiy-storchaka commented on Sep 6, 2025
Since this is a very old behavior, it is not worth to backport the change.
pythongh-138205: Remove the `resize` method on `mmap` object on platf…
gh-138205: explicit mention to `mmap.mmap.resize` in "Porting to Pyth…
pythongh-138205: explicit mention to `mmap.mmap.resize` in "Porting t…