Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitee26ca1

Browse files
authored
pythongh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (python#105185)
1 parent77d2579 commitee26ca1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎Doc/c-api/marshal.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ unmarshalling. Version 2 uses a binary format for floating point numbers.
2525
the least-significant 32 bits of *value*; regardless of the size of the
2626
native:c:expr:`long` type. *version* indicates the file format.
2727
28+
This function can fail, in which case it sets the error indicator.
29+
Use:c:func:`PyErr_Occurred` to check for that.
2830
2931
..c:function::voidPyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version)
3032
3133
Marshal a Python object, *value*, to *file*.
3234
*version* indicates the file format.
3335
36+
This function can fail, in which case it sets the error indicator.
37+
Use:c:func:`PyErr_Occurred` to check for that.
3438
3539
..c:function:: PyObject*PyMarshal_WriteObjectToString(PyObject *value, int version)
3640

‎Python/marshal.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@ w_clear_refs(WFILE *wf)
625625
}
626626

627627
/* version currently has no effect for writing ints. */
628+
/* Note that while the documentation states that this function
629+
* can error, currently it never does. Setting an exception in
630+
* this function should be regarded as an API-breaking change.
631+
*/
628632
void
629633
PyMarshal_WriteLongToFile(longx,FILE*fp,intversion)
630634
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp