Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[3.8] gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (GH-105185) #105222

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

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-105184: document that marshal functions can fail and need to be ch…
…ecked with PyErr_Occurred (GH-105185)

(cherry picked from commit ee26ca1)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
  • Loading branch information
iritkatriel authored and miss-islington committed Jun 2, 2023
commit 958cb0b109271d71ddb0d204a3c08237a0975e3b
4 changes: 4 additions & 0 deletions 4 Doc/c-api/marshal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ unmarshalling. Version 2 uses a binary format for floating point numbers.
the least-significant 32 bits of *value*; regardless of the size of the
native :c:type:`long` type. *version* indicates the file format.

This function can fail, in which case it sets the error indicator.
Use :c:func:`PyErr_Occurred` to check for that.

.. c:function:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version)

Marshal a Python object, *value*, to *file*.
*version* indicates the file format.

This function can fail, in which case it sets the error indicator.
Use :c:func:`PyErr_Occurred` to check for that.

.. c:function:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version)

Expand Down
4 changes: 4 additions & 0 deletions 4 Python/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@ w_clear_refs(WFILE *wf)
}

/* version currently has no effect for writing ints. */
/* Note that while the documentation states that this function
* can error, currently it never does. Setting an exception in
* this function should be regarded as an API-breaking change.
*/
void
PyMarshal_WriteLongToFile(long x, FILE *fp, int version)
{
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.