Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-111835: Add seekable method to mmap.mmap #111852

Merged
merged 17 commits into from
Nov 9, 2023
Merged

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Nov 8, 2023

@corona10
Copy link
Member Author

corona10 commented Nov 8, 2023

@serhiy-storchaka cc @vstinner
As the issue reporter said, they can use seekable by subclassing mmap itself.
But this change definitely helpful to people who need to use library which checks that the file object supports seekable() method.
(I don't want to say it must be added but it is good to be added)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

Doc/library/mmap.rst Outdated Show resolved Hide resolved
@serhiy-storchaka
Copy link
Member

mmap.seek() always return None. It can make mmap not appropriate substitution for files. Adding seekable() method can break existing code.

@corona10
Copy link
Member Author

corona10 commented Nov 8, 2023

mmap.seek() always return None. It can make mmap not appropriate substitution for files. Adding seekable() method can break existing code.

I left a comment for this.
#111835 (comment)
But I'm not sure how it will break the user's code even if we update seek() to return the current position.
I can not guess how people are doing something with None value.

Doc/library/mmap.rst Outdated Show resolved Hide resolved
Doc/whatsnew/3.13.rst Show resolved Hide resolved
Lib/test/test_mmap.py Outdated Show resolved Hide resolved
Modules/mmapmodule.c Outdated Show resolved Hide resolved
Doc/whatsnew/3.13.rst Outdated Show resolved Hide resolved
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

@corona10 corona10 merged commit 6046aec into python:main Nov 9, 2023
30 checks passed
@corona10
Copy link
Member Author

corona10 commented Nov 9, 2023

@serhiy-storchaka @vstinner
Thank you for the reviews!!

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.

3 participants