Skip to content

mmap.resize() can raise SystemError #138205

Description

@serhiy-storchaka

Bug report

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.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    3.13only security fixes
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Aug 27, 2025
  2. YvesDup commented on Aug 27, 2025

    @YvesDup
    Contributor

    This also happens on MacOSX 15.1, M4 pro

  3. serhiy-storchaka commented on Aug 28, 2025

    @serhiy-storchaka
    MemberAuthor

    There was other improper use of SystemError in the mmap module: #7381.

  4. aisk commented on Aug 31, 2025

    @aisk
    Member

    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.

  5. added a commit that references this issue on Sep 6, 2025
  6. serhiy-storchaka commented on Sep 6, 2025

    @serhiy-storchaka
    MemberAuthor

    Since this is a very old behavior, it is not worth to backport the change.

  7. added a commit that references this issue on Sep 9, 2025
  8. added a commit that references this issue on Jan 5, 2026
  9. added a commit that references this issue on Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions