Skip to content

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

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:os_read_read_max
Nov 22, 2018
Merged

bpo-24658: os.read() reuses _PY_READ_MAX#10657
vstinner merged 1 commit into
python:masterfrom
vstinner:os_read_read_max

Conversation

@vstinner

@vstinner vstinner commented Nov 22, 2018

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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

@bedevere-bot

Copy link
Copy Markdown

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
Copy Markdown

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