Repository navigation
gh-159185: Document that PyMarshal_WriteObjectToFile can silently truncate before 3.16 - #159201
Merged
Merged
Conversation
…lently before 3.16 In Python 3.15 and earlier, PyMarshal_WriteObjectToFile() ignores most marshalling errors and all I/O errors: it returns without setting the error indicator after writing only part of the data. PyMarshal_WriteLongToFile() ignores I/O errors in the same way. That was fixed in 3.16 by pythongh-155907, which is not backported. Tell the users of the older versions so that they can check what was written.
gpshead
enabled auto-merge (squash)
October 11, 2026 21:44
Documentation build overview
|
|
Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-159202 is a backport of this pull request to the 3.15 branch. |
|
GH-159203 is a backport of this pull request to the 3.14 branch. |
gpshead
added a commit
that referenced
this pull request
Oct 11, 2026
…tly truncate before 3.16 (GH-159201) (#159202) gh-159185: Document that PyMarshal_WriteObjectToFile can silently truncate before 3.16 (GH-159201) gh-159185: Document that the PyMarshal file writers can fail silently before 3.16 In Python 3.15 and earlier, PyMarshal_WriteObjectToFile() ignores most marshalling errors and all I/O errors: it returns without setting the error indicator after writing only part of the data. PyMarshal_WriteLongToFile() ignores I/O errors in the same way. That was fixed in 3.16 by gh-155907, which is not backported. Tell the users of the older versions so that they can check what was written. (cherry picked from commit b3714a5) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
gpshead
added a commit
that referenced
this pull request
Oct 11, 2026
…tly truncate before 3.16 (GH-159201) (#159203) gh-159185: Document that PyMarshal_WriteObjectToFile can silently truncate before 3.16 (GH-159201) gh-159185: Document that the PyMarshal file writers can fail silently before 3.16 In Python 3.15 and earlier, PyMarshal_WriteObjectToFile() ignores most marshalling errors and all I/O errors: it returns without setting the error indicator after writing only part of the data. PyMarshal_WriteLongToFile() ignores I/O errors in the same way. That was fixed in 3.16 by gh-155907, which is not backported. Tell the users of the older versions so that they can check what was written. (cherry picked from commit b3714a5) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Python 3.15 and earlier,
PyMarshal_WriteObjectToFile()can return without setting the error indicator after writing only part of the data, for example when the value contains an unmarshallable object or the write fails. That was fixed in 3.16 by gh-155907, which was deliberately not backported. This adds a note so that users of the older versions know to check what was written or use an alternate API. Docs only; intended for backport to 3.15 and 3.14.marshal.dumps()crashes when a set is modified while it is being marshalled #159185