@@ -549,7 +549,7 @@ w_complex_object(PyObject *v, char flag, WFILE *p)
549549 w_object (co -> co_lnotab , p );
550550 }
551551 else if (PyObject_CheckBuffer (v )) {
552- /* Write unknown bytes-like objects as a byte string */
552+ /* Write unknown bytes-like objects as a bytes object */
553553 Py_buffer view ;
554554 if (PyObject_GetBuffer (v , & view , PyBUF_SIMPLE ) != 0 ) {
555555 w_byte (TYPE_UNKNOWN , p );
@@ -1079,7 +1079,7 @@ r_object(RFILE *p)
10791079 if (PyErr_Occurred ())
10801080 break ;
10811081 if (n < 0 || n > SIZE32_MAX ) {
1082- PyErr_SetString (PyExc_ValueError , "bad marshal data (string size out of range)" );
1082+ PyErr_SetString (PyExc_ValueError , "bad marshal data (bytes object size out of range)" );
10831083 break ;
10841084 }
10851085 v = PyBytes_FromStringAndSize ((char * )NULL , n );
@@ -1103,7 +1103,7 @@ r_object(RFILE *p)
11031103 if (PyErr_Occurred ())
11041104 break ;
11051105 if (n < 0 || n > SIZE32_MAX ) {
1106- PyErr_SetString (PyExc_ValueError , "bad marshal data (unicode size out of range)" );
1106+ PyErr_SetString (PyExc_ValueError , "bad marshal data (string size out of range)" );
11071107 break ;
11081108 }
11091109 goto _read_ascii ;
@@ -1143,7 +1143,7 @@ r_object(RFILE *p)
11431143 if (PyErr_Occurred ())
11441144 break ;
11451145 if (n < 0 || n > SIZE32_MAX ) {
1146- PyErr_SetString (PyExc_ValueError , "bad marshal data (unicode size out of range)" );
1146+ PyErr_SetString (PyExc_ValueError , "bad marshal data (string size out of range)" );
11471147 break ;
11481148 }
11491149 if (n != 0 ) {
@@ -1594,7 +1594,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
15941594 if (wf .ptr - base > PY_SSIZE_T_MAX ) {
15951595 Py_DECREF (wf .str );
15961596 PyErr_SetString (PyExc_OverflowError ,
1597- "too much marshal data for a string " );
1597+ "too much marshal data for a bytes object " );
15981598 return NULL ;
15991599 }
16001600 if (_PyBytes_Resize (& wf .str , (Py_ssize_t )(wf .ptr - base )) < 0 )
@@ -1640,8 +1640,7 @@ PyDoc_STRVAR(dump_doc,
16401640"dump(value, file[, version])\n\
16411641\n\
16421642Write the value on the open file. The value must be a supported type.\n\
1643- The file must be an open file object such as sys.stdout or returned by\n\
1644- open() or os.popen(). It must be opened in binary mode ('wb' or 'w+b').\n\
1643+ The file must be a writeable binary file.\n\
16451644\n\
16461645If the value has (or contains an object that has) an unsupported type, a\n\
16471646ValueError exception is raised - but garbage data will also be written\n\
@@ -1697,8 +1696,7 @@ PyDoc_STRVAR(load_doc,
16971696Read one value from the open file and return it. If no valid value is\n\
16981697read (e.g. because the data has a different Python version's\n\
16991698incompatible marshal format), raise EOFError, ValueError or TypeError.\n\
1700- The file must be an open file object opened in binary mode ('rb' or\n\
1701- 'r+b').\n\
1699+ The file must be a readable binary file.\n\
17021700\n\
17031701Note: If an object containing an unsupported type was marshalled with\n\
17041702dump(), load() will substitute None for the unmarshallable type." );
@@ -1717,7 +1715,7 @@ marshal_dumps(PyObject *self, PyObject *args)
17171715PyDoc_STRVAR (dumps_doc ,
17181716"dumps(value[, version])\n\
17191717\n\
1720- Return the string that would be written to a file by dump(value, file).\n\
1718+ Return the bytes object that would be written to a file by dump(value, file).\n\
17211719The value must be a supported type. Raise a ValueError exception if\n\
17221720value has (or contains an object that has) an unsupported type.\n\
17231721\n\
@@ -1753,8 +1751,8 @@ marshal_loads(PyObject *self, PyObject *args)
17531751PyDoc_STRVAR (loads_doc ,
17541752"loads(bytes)\n\
17551753\n\
1756- Convert the bytes object to a value. If no valid value is found, raise \n\
1757- EOFError, ValueError or TypeError. Extra characters in the input are\n\
1754+ Convert the bytes-like object to a value. If no valid value is found,\n\
1755+ raise EOFError, ValueError or TypeError. Extra bytes in the input are\n\
17581756ignored." );
17591757
17601758static PyMethodDef marshal_methods [] = {
@@ -1792,8 +1790,8 @@ Functions:\n\
17921790\n\
17931791dump() -- write value to a file\n\
17941792load() -- read value from a file\n\
1795- dumps() -- write value to a string \n\
1796- loads() -- read value from a string " );
1793+ dumps() -- marshal value as a bytes object \n\
1794+ loads() -- read value from a bytes-like object " );
17971795
17981796
17991797
0 commit comments