Add docs for planned improved handling of the marshalling of

unmarshallable objects.
This commit is contained in:
Guido van Rossum 1996-06-26 20:20:57 +00:00
parent f2e98b4f55
commit bbb1e26a67
2 changed files with 20 additions and 4 deletions

View file

@ -61,19 +61,27 @@ The module defines these functions:
\code{sys.stdout} or returned by \code{open()} or \code{sys.stdout} or returned by \code{open()} or
\code{posix.popen()}. \code{posix.popen()}.
If the value has an unsupported type, garbage is written which cannot If the value has (or contains an object that has) an unsupported type,
be read back by \code{load()}. a \code{ValueError} exception is raised -- but garbage data will also
be written to the file. The object will not be properly read back by
\code{load()}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{load}{file} \begin{funcdesc}{load}{file}
Read one value from the open file and return it. If no valid value Read one value from the open file and return it. If no valid value
is read, raise \code{EOFError}, \code{ValueError} or is read, raise \code{EOFError}, \code{ValueError} or
\code{TypeError}. The file must be an open file object. \code{TypeError}. The file must be an open file object.
Warning: If an object containing an unsupported type was marshalled
with \code{dump()}, \code{load()} will substitute \code{None} for the
unmarshallable type.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{dumps}{value} \begin{funcdesc}{dumps}{value}
Return the string that would be written to a file by Return the string that would be written to a file by
\code{dump(value, file)}. The value must be a supported type. \code{dump(value, file)}. The value must be a supported type.
Raise a \code{ValueError} exception if value has (or contains an
object that has) an unsupported type.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{loads}{string} \begin{funcdesc}{loads}{string}

View file

@ -61,19 +61,27 @@ The module defines these functions:
\code{sys.stdout} or returned by \code{open()} or \code{sys.stdout} or returned by \code{open()} or
\code{posix.popen()}. \code{posix.popen()}.
If the value has an unsupported type, garbage is written which cannot If the value has (or contains an object that has) an unsupported type,
be read back by \code{load()}. a \code{ValueError} exception is raised -- but garbage data will also
be written to the file. The object will not be properly read back by
\code{load()}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{load}{file} \begin{funcdesc}{load}{file}
Read one value from the open file and return it. If no valid value Read one value from the open file and return it. If no valid value
is read, raise \code{EOFError}, \code{ValueError} or is read, raise \code{EOFError}, \code{ValueError} or
\code{TypeError}. The file must be an open file object. \code{TypeError}. The file must be an open file object.
Warning: If an object containing an unsupported type was marshalled
with \code{dump()}, \code{load()} will substitute \code{None} for the
unmarshallable type.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{dumps}{value} \begin{funcdesc}{dumps}{value}
Return the string that would be written to a file by Return the string that would be written to a file by
\code{dump(value, file)}. The value must be a supported type. \code{dump(value, file)}. The value must be a supported type.
Raise a \code{ValueError} exception if value has (or contains an
object that has) an unsupported type.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{loads}{string} \begin{funcdesc}{loads}{string}