GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — gh-157242: Do not close io.BytesIO on MemoryError by vstinner · Pull Request #157344 · python/cpython Conversation
|
|
io.StringIO makes the object inconsistent on MemoryError! It looks more complicated to fix it, so I focused this PR on io.BytesIO. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There is still an issue in the Python implementation of I merge this change anyway to make the situation a little bit better. Replacing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Replace _PyBytes_Resize() with _PyBytes_ResizeKeepOnError(). Fix truncate(): on error, restore string_size to its previous value.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-159275 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…159275) gh-157242: Do not close io.BytesIO on MemoryError (GH-157344) Replace _PyBytes_Resize() with _PyBytes_ResizeKeepOnError(). Fix truncate(): on error, restore string_size to its previous value. (cherry picked from commit 23eda00) Co-authored-by: Victor Stinner <[email protected]>
* gh-157242: Add _PyBytes_ResizeKeepOnError() function (#157243) Add a new internal _PyBytes_ResizeKeepOnError() function similar to _PyBytes_Resize() but leaves the bytes object unchanged on error. Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]> (cherry picked from commit f5dd52d) * gh-157242: Fix undefined behavior in _PyBytes_ResizeKeepOnError() (#157352) Fix undefined behavior in _PyBytes_ResizeKeepOnError(): raise OverflowError on integer overflow. (cherry picked from commit 63d4398) * gh-157242: Do not close io.BytesIO on MemoryError (#157344) Replace _PyBytes_Resize() with _PyBytes_ResizeKeepOnError(). Fix truncate(): on error, restore string_size to its previous value. (cherry picked from commit 23eda00) --------- Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.