summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-06-27 16:51:46 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-06-27 16:51:46 (GMT)
commitef82d2fdfe1aba18e29abbd59b22d19d490e9fca (patch)
treef39fe4de79b90f97ad2d25ef493cde78ee89f745 /Doc
parent8d97e33bb76c322cdb08dbf97c26d787cd3488a7 (diff)
downloadcpython-ef82d2fdfe1aba18e29abbd59b22d19d490e9fca.zip
cpython-ef82d2fdfe1aba18e29abbd59b22d19d490e9fca.tar.gz
cpython-ef82d2fdfe1aba18e29abbd59b22d19d490e9fca.tar.bz2
Patch #923098: Share interned strings in marshal.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/api/utilities.tex17
-rw-r--r--Doc/lib/libmarshal.tex18
2 files changed, 31 insertions, 4 deletions
diff --git a/Doc/api/utilities.tex b/Doc/api/utilities.tex
index f4fa899..bfcfe27 100644
--- a/Doc/api/utilities.tex
+++ b/Doc/api/utilities.tex
@@ -283,20 +283,31 @@ data must be opened in binary mode.
Numeric values are stored with the least significant byte first.
-\begin{cfuncdesc}{void}{PyMarshal_WriteLongToFile}{long value, FILE *file}
+The module supports two versions of the data format: version 0 is the
+historical version, version 1 (new in Python 2.4) shares interned
+strings in the file, and upon unmarshalling. \var{Py_MARSHAL_VERSION}
+indicates the current file format (currently 1).
+
+\begin{cfuncdesc}{void}{PyMarshal_WriteLongToFile}{long value, FILE *file, int version}
Marshal a \ctype{long} integer, \var{value}, to \var{file}. This
will only write the least-significant 32 bits of \var{value};
regardless of the size of the native \ctype{long} type.
+
+ \versionchanged[\var{version} indicates the file format]{2.4}
\end{cfuncdesc}
\begin{cfuncdesc}{void}{PyMarshal_WriteObjectToFile}{PyObject *value,
- FILE *file}
+ FILE *file, int version}
Marshal a Python object, \var{value}, to \var{file}.
+
+ \versionchanged[\var{version} indicates the file format]{2.4}
\end{cfuncdesc}
-\begin{cfuncdesc}{PyObject*}{PyMarshal_WriteObjectToString}{PyObject *value}
+\begin{cfuncdesc}{PyObject*}{PyMarshal_WriteObjectToString}{PyObject *value, int version}
Return a string object containing the marshalled representation of
\var{value}.
+
+ \versionchanged[\var{version} indicates the file format]{2.4}
\end{cfuncdesc}
The following functions allow marshalled values to be read back in.
diff --git a/Doc/lib/libmarshal.tex b/Doc/lib/libmarshal.tex
index f597e84..53ca668 100644
--- a/Doc/lib/libmarshal.tex
+++ b/Doc/lib/libmarshal.tex
@@ -73,6 +73,9 @@ The module defines these functions:
a \exception{ValueError} exception is raised --- but garbage data
will also be written to the file. The object will not be properly
read back by \function{load()}.
+
+ \versionadded[The \var{version} argument indicates the data
+ format that \code{dumps} should use.]{2.4}
\end{funcdesc}
\begin{funcdesc}{load}{file}
@@ -86,11 +89,14 @@ The module defines these functions:
\code{None} for the unmarshallable type.}
\end{funcdesc}
-\begin{funcdesc}{dumps}{value}
+\begin{funcdesc}{dumps}{value\optional{, version}}
Return the string that would be written to a file by
\code{dump(\var{value}, \var{file})}. The value must be a supported
type. Raise a \exception{ValueError} exception if value has (or
contains an object that has) an unsupported type.
+
+ \versionadded[The \var{version} argument indicates the data
+ format that \code{dumps} should use.]{2.4}
\end{funcdesc}
\begin{funcdesc}{loads}{string}
@@ -98,3 +104,13 @@ The module defines these functions:
\exception{EOFError}, \exception{ValueError} or
\exception{TypeError}. Extra characters in the string are ignored.
\end{funcdesc}
+
+In addition, the following constants are defined:
+
+\begin{datadesc}{version}
+ Indicates the format that the module uses. Version 0 is the
+ historical format, version 1 (added in Python 2.4) shares
+ interned strings. The current version is 1.
+
+ \versionadded{2.4}
+\end{datadesc} \ No newline at end of file