bpo-24658: os.read() reuses _PY_READ_MAX by vstinner · Pull Request #10657 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

vstinner

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

@vstinner

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

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

@miss-islington

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 22, 2018

@vstinner @miss-islington

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

@bedevere-bot

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 22, 2018

@vstinner @miss-islington

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

@miss-islington @vstinner

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

@miss-islington @vstinner

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

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()