mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (#105185)
This commit is contained in:
		
							parent
							
								
									77d2579586
								
							
						
					
					
						commit
						ee26ca13a1
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -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
 | 
					   the least-significant 32 bits of *value*; regardless of the size of the
 | 
				
			||||||
   native :c:expr:`long` type.  *version* indicates the file format.
 | 
					   native :c:expr:`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)
 | 
					.. c:function:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Marshal a Python object, *value*, to *file*.
 | 
					   Marshal a Python object, *value*, to *file*.
 | 
				
			||||||
   *version* indicates the file format.
 | 
					   *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)
 | 
					.. c:function:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -625,6 +625,10 @@ w_clear_refs(WFILE *wf)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* version currently has no effect for writing ints. */
 | 
					/* 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
 | 
					void
 | 
				
			||||||
PyMarshal_WriteLongToFile(long x, FILE *fp, int version)
 | 
					PyMarshal_WriteLongToFile(long x, FILE *fp, int version)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue