Skip to content

mmap.size() raises OSError on Unix for anonymous memory #87595

Closed

Description

@ZackerySpytz
BPO 43429
Nosy @ZackerySpytz
PRs
  • gh-87595: mmap.size() now returns the size on Unix for anonymous memory #24781
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-03-07.23:29:06.867>
    labels = ['extension-modules', 'type-bug', '3.10']
    title = 'mmap.size() raises OSError on Unix for anonymous memory'
    updated_at = <Date 2021-03-07.23:33:14.666>
    user = 'https://github.com/ZackerySpytz'

    bugs.python.org fields:

    activity = <Date 2021-03-07.23:33:14.666>
    actor = 'ZackerySpytz'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2021-03-07.23:29:06.867>
    creator = 'ZackerySpytz'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43429
    keywords = ['patch']
    message_count = 1.0
    messages = ['388252']
    nosy_count = 1.0
    nosy_names = ['ZackerySpytz']
    pr_nums = ['24781']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue43429'
    versions = ['Python 3.10']

    Linked PRs

    Activity

    1. ZackerySpytz commented on Mar 7, 2021

      ZackerySpytzmannequin
      MannequinAuthor

      For anonymous memory, mmap.size() works without issue on Windows, but it raises OSError on Unix.

    2. transferred this issue fromon Apr 10, 2022
    3. added
      3.11only security fixes
      3.12only security fixes
      and removed on May 12, 2023
    4. serhiy-storchaka commented on Aug 29, 2025

      @serhiy-storchaka
      Member

      The question is whether this should be classified as a bug fix or a new feature. It seems that mmap.size() never worked for anonymous mapping on Unix, so there is no user code that depends on it. Although this limitation was not documented.

      There are now two PRs, #24781 and #138198. The former adds this as a new feature and has more documentation, the latter treat it as a bug fix and takes into account trackfd.

      I think we should go with #24781, after it was updated.

    5. added
      type-featureA feature request or enhancement
      3.15bugs and security fixes
      and removed
      type-bugAn unexpected behavior, bug, or error
      3.11only security fixes
      3.12only security fixes
      on Aug 29, 2025
    6. added a commit that references this issue on Sep 2, 2025
    7. added 2 commits that reference this issue on Sep 2, 2025
    8. serhiy-storchaka commented on Sep 2, 2025

      @serhiy-storchaka
      Member

      Also, it was decided in the discussion for #138238 that it is better to raise a dedicated error for trackfd=False instead of triggering an OSError by passing invalid handler or descriptor to the OS API.

    9. added a commit that references this issue on Sep 4, 2025
    10. added a commit that references this issue on Sep 4, 2025
    11. added 2 commits that reference this issue on Sep 9, 2025
    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 fixesextension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions