Skip to content

CLN: mmap used by only read_csv #46967

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

Merged
merged 1 commit into from
May 9, 2022
Merged

CLN: mmap used by only read_csv #46967

merged 1 commit into from
May 9, 2022

Conversation

twoertwein
Copy link
Member

Make it clear that mmap is only ever used by read_csv.

else:
# Binary mode
handle = open(handle, mode)
handle = open(handle, "rb")
Copy link
Member Author

Choose a reason for hiding this comment

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

mmap is used only for reading and there should be no point in opening the file in text mode as mmap should bypass that.

@jreback jreback added the IO CSV read_csv, to_csv label May 8, 2022
@jreback jreback added this to the 1.5 milestone May 8, 2022
if encoding and "b" not in mode:
# Encoding
handle = open(handle, mode, encoding=encoding, errors=errors, newline="")
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

any tests validate this? (nbd if you can't come up with an example, but ideally)

Copy link
Member Author

Choose a reason for hiding this comment

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

This encoding+memory_map test should test it:

def test_encoding_memory_map(all_parsers, encoding):

@jreback jreback merged commit ba2fdb1 into pandas-dev:main May 9, 2022
@twoertwein twoertwein deleted the mmap branch May 26, 2022 01:59
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants