[Python-checkins] r54088 - python/trunk/Doc/api/memory.tex

georg.brandl python-checkins at python.org
Fri Mar 2 21:30:15 CET 2007


Author: georg.brandl
Date: Fri Mar  2 21:30:14 2007
New Revision: 54088

Modified:
   python/trunk/Doc/api/memory.tex
Log:
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.


Modified: python/trunk/Doc/api/memory.tex
==============================================================================
--- python/trunk/Doc/api/memory.tex	(original)
+++ python/trunk/Doc/api/memory.tex	Fri Mar  2 21:30:14 2007
@@ -100,7 +100,9 @@
   memory block is resized but is not freed, and the returned pointer
   is non-\NULL.  Unless \var{p} is \NULL, it must have been
   returned by a previous call to \cfunction{PyMem_Malloc()} or
-  \cfunction{PyMem_Realloc()}.
+  \cfunction{PyMem_Realloc()}. If the request fails,
+  \cfunction{PyMem_Realloc()} returns \NULL{} and \var{p} remains a
+  valid pointer to the previous memory area.
 \end{cfuncdesc}
 
 \begin{cfuncdesc}{void}{PyMem_Free}{void *p}
@@ -124,7 +126,8 @@
 \begin{cfuncdesc}{\var{TYPE}*}{PyMem_Resize}{void *p, TYPE, size_t n}
   Same as \cfunction{PyMem_Realloc()}, but the memory block is resized
   to \code{(\var{n} * sizeof(\var{TYPE}))} bytes.  Returns a pointer
-  cast to \ctype{\var{TYPE}*}.
+  cast to \ctype{\var{TYPE}*}. On return, \var{p} will be a pointer to
+  the new memory area, or \NULL{} in the event of failure.
 \end{cfuncdesc}
 
 \begin{cfuncdesc}{void}{PyMem_Del}{void *p}


More information about the Python-checkins mailing list