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

bpo-24658: os.read() reuses _PY_READ_MAX #10657

Merged
merged 1 commit into from
Nov 22, 2018
Merged

bpo-24658: os.read() reuses _PY_READ_MAX #10657

merged 1 commit into from
Nov 22, 2018

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 22, 2018

os_read_impl() now also truncates the size of _PY_READ_MAX (INT_MAX)
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes.

https://bugs.python.org/issue24658

os_read_impl() now also truncates the size of _PY_READ_MAX (INT_MAX)
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes.
@vstinner
Copy link
Member Author

Maybe this change should be backported to Python 3.6 and 3.7.

@vstinner vstinner merged commit 9a0d7a7 into python:master Nov 22, 2018
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@vstinner vstinner deleted the os_read_read_max branch November 22, 2018 14:03
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2018
os_read_impl() now also truncates the size to _PY_READ_MAX
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS).
(cherry picked from commit 9a0d7a7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@bedevere-bot
Copy link

GH-10658 is a backport of this pull request to the 3.7 branch.

@bedevere-bot
Copy link

GH-10659 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2018
os_read_impl() now also truncates the size to _PY_READ_MAX
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS).
(cherry picked from commit 9a0d7a7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
miss-islington added a commit that referenced this pull request Nov 22, 2018
os_read_impl() now also truncates the size to _PY_READ_MAX
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS).
(cherry picked from commit 9a0d7a7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
miss-islington added a commit that referenced this pull request Nov 22, 2018
os_read_impl() now also truncates the size to _PY_READ_MAX
on macOS, to avoid to allocate a larger buffer even if _Py_read() is
limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS).
(cherry picked from commit 9a0d7a7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@ahmedmagds
Copy link

It is a naive question, Can anyone say how can I apply this fix to my script?
import pickle
pickle_out = open("file","wb")
pickle.dump(sequences_dict, pickle_out)
pickle_out.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants