Skip to content

Conversation

ZackerySpytz
Copy link
Contributor

@ZackerySpytz ZackerySpytz commented Mar 7, 2021

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

https://bugs.python.org/issue43429

Previously, the size would be returned on Windows and an OSError would
be raised on Unix.
@github-actions
Copy link

github-actions bot commented Apr 7, 2021

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

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2021
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Aug 5, 2022
Copy link
Contributor

@furkanonder furkanonder left a 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?

@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
Copy link
Member

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

@arhadthedev arhadthedev added the needs backport to 3.11 only security fixes label May 12, 2023
@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Aug 29, 2025

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

@vstinner
Copy link
Member

vstinner commented Sep 2, 2025

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

@serhiy-storchaka serhiy-storchaka merged commit 32032ee into python:main Sep 2, 2025
45 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 2, 2025
…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
…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
Copy link

bedevere-app bot commented Sep 2, 2025

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

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

bedevere-app bot commented Sep 2, 2025

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 2, 2025
Copy link
Contributor Author

@ZackerySpytz ZackerySpytz left a 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.


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

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.

For anonymous mapping, return its size.

.. versionchanged:: next
Supports anonymous mapping on Unix.
Copy link
Contributor Author

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.

Comment on lines +4 to +5
would be raised on Unix.
Raise :exc:`ValueError` instead of :exc:`OSError` with ``trackfd=False``.
Copy link
Contributor Author

@ZackerySpytz ZackerySpytz Sep 2, 2025

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``.

@AA-Turner
Copy link
Member

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

@ZackerySpytz
Copy link
Contributor Author

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

@ZackerySpytz
Copy link
Contributor Author

@serhiy-storchaka I have created GH-138494.

lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
…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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.