GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-87595: mmap.size() now returns the size on Unix for anonymous memory by ZackerySpytz · Pull Request #24781 · python/cpython

Conversation

@ZackerySpytz

@ZackerySpytz ZackerySpytz commented Mar 7, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Previously, the size would be returned on Windows and an OSError would
be raised on Unix.

https://bugs.python.org/issue43429

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ZackerySpytz
bpo-43429: mmap.size() now returns the size on Unix for anonymous memory
c90c396
Previously, the size would be returned on Windows and an OSError would
be raised on Unix.
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 7, 2021
@bedevere-bot bedevere-bot added the awaiting review label Mar 7, 2021
@github-actions

github-actions Bot commented Apr 7, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2021
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 5, 2022
furkanonder
furkanonder requested changes May 12, 2023
View reviewed changes

@furkanonder furkanonder left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @ZackerySpytz Could you resolve the conflicts?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels May 12, 2023
@arhadthedev arhadthedev changed the title bpo-43429: mmap.size() now returns the size on Unix for anonymous memory gh-87595: mmap.size() now returns the size on Unix for anonymous memory May 12, 2023
arhadthedev added 2 commits May 12, 2023 21:16
@arhadthedev
Bump versionchanged to 3.12
7e54ba0
@arhadthedev
Merge branch 'main' into bpo-43429-mmap-size-platforms
e538300
@arhadthedev

arhadthedev commented May 12, 2023

Copy link
Copy Markdown
Member

Marking as needs backport to 3.11 because the parent issue is marked as type-bug An unexpected behavior, bug, or error .

furkanonder reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev arhadthedev added the needs backport to 3.11 only security fixes label May 12, 2023
furkanonder
furkanonder approved these changes May 12, 2023
View reviewed changes
iritkatriel
iritkatriel reviewed May 14, 2023
View reviewed changes
Comment thread Doc/library/mmap.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev
Address the review
73598fb
@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes and removed needs backport to 3.11 only security fixes labels May 9, 2024
@hugovk hugovk removed the needs backport to 3.12 only security fixes label Apr 25, 2025
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Aug 27, 2025
mmap.size() raises OSError on Unix for anonymous memory #87595
Closed
@serhiy-storchaka serhiy-storchaka mentioned this pull request Aug 27, 2025
gh-87595: Fix size method on anonymous mmap object #138198
Closed
@serhiy-storchaka

serhiy-storchaka commented Aug 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@ZackerySpytz, could you please update your PR to 3.15? It should take into account trackfd, like in #138198.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka added 4 commits September 2, 2025 19:05
@serhiy-storchaka
Merge branch 'main' into bpo-43429-mmap-size-platforms
7b144da
@serhiy-storchaka
Remove excessive documentation. Re-target to 3.15.
833ea7d
@serhiy-storchaka
Fix for trackfd=False. Raise ValueError instead of OSError.
8b4e2ef
@serhiy-storchaka
Remove unused import.
e6fa218
@serhiy-storchaka
serhiy-storchaka requested a review from vstinner September 2, 2025 16:37
@serhiy-storchaka serhiy-storchaka mentioned this pull request Sep 2, 2025
gh-78502: Add a trackfd parameter to mmap.mmap() on Windows #138238
Merged
@vstinner

vstinner commented Sep 2, 2025

Copy link
Copy Markdown
Member

I'm not sure that @ZackerySpytz is still active. Maybe a new PR should be written?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka merged commit 32032ee into python:main Sep 2, 2025
@miss-islington-app

miss-islington-app Bot commented Sep 2, 2025

Copy link
Copy Markdown

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Sep 2, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 2, 2025
@ZackerySpytz @serhiy-storchaka @miss-islington
pythongh-87595: Support mmap.size() for anonymous mapping on Unix (py…
147eb94
…thonGH-24781)

Previously, the size would be returned on Windows and an OSError would
be raised on Unix.

Also, raise ValueError instead of OSError for trackfd=False.
(cherry picked from commit 32032ee)

Co-authored-by: Zackery Spytz <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 2, 2025
@ZackerySpytz @serhiy-storchaka @miss-islington
pythongh-87595: Support mmap.size() for anonymous mapping on Unix (py…
8c45634
…thonGH-24781)

Previously, the size would be returned on Windows and an OSError would
be raised on Unix.

Also, raise ValueError instead of OSError for trackfd=False.
(cherry picked from commit 32032ee)

Co-authored-by: Zackery Spytz <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app

bedevere-app Bot commented Sep 2, 2025

Copy link
Copy Markdown

GH-138404 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 2, 2025
@bedevere-app

bedevere-app Bot commented Sep 2, 2025

Copy link
Copy Markdown

GH-138405 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Sep 2, 2025
ZackerySpytz
ZackerySpytz commented Sep 2, 2025
View reviewed changes

@ZackerySpytz ZackerySpytz left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @serhiy-storchaka. We must modify some of the changes you have made to this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/mmap.rst

Return the length of the file, which can be larger than the size of the
memory-mapped area.
For anonymous mapping, return its size.

@ZackerySpytz ZackerySpytz Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For anonymous mapping, return its size.
For an anonymous mapping, return its size.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/mmap.rst
For anonymous mapping, return its size.

.. versionchanged:: next
Supports anonymous mapping on Unix.

@ZackerySpytz ZackerySpytz Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Supports anonymous mapping on Unix.
Anonymous mappings are now supported on Unix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS.d/next/Library/2021-03-07-16-31-36.bpo-43429.Koa0mf.rst
Comment on lines +4 to +5
would be raised on Unix.
Raise :exc:`ValueError` instead of :exc:`OSError` with ``trackfd=False``.

@ZackerySpytz ZackerySpytz Sep 2, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
would be raised on Unix.
Raise :exc:`ValueError` instead of :exc:`OSError` with ``trackfd=False``.
would be raised on Unix. :exc:`ValueError` is now raised instead of
:exc:`OSError` when ``trackfd=False``.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AA-Turner

AA-Turner commented Sep 2, 2025

Copy link
Copy Markdown
Member

@ZackerySpytz this has been merged, please would you open a new PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZackerySpytz

ZackerySpytz commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

I'm well aware that this PR has been merged, thank you very much.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZackerySpytz

ZackerySpytz commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka I have created GH-138494.

vstinner and serhiy-storchaka reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
@ZackerySpytz @serhiy-storchaka @lkollar
pythongh-87595: Support mmap.size() for anonymous mapping on Unix (py…
9869e76
…thonGH-24781)

Previously, the size would be returned on Windows and an OSError would
be raised on Unix.

Also, raise ValueError instead of OSError for trackfd=False.

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel left review comments
@furkanonder furkanonder furkanonder approved these changes
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@ZackerySpytz @arhadthedev @serhiy-storchaka @vstinner @AA-Turner @iritkatriel @furkanonder @hugovk @the-knights-who-say-ni @ezio-melotti @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.