Merged revisions 77593,77702-77703,77858,77887,78113-78115,78117,78245,78385-78386,78496,78760,78771-78773,78802 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77593 | georg.brandl | 2010-01-18 00:33:53 +0100 (Mo, 18 Jan 2010) | 1 line

  Fix internal reference.
........
  r77702 | georg.brandl | 2010-01-23 09:43:31 +0100 (Sa, 23 Jan 2010) | 1 line

  #7762: fix refcount annotation of PyUnicode_Tailmatch().
........
  r77703 | georg.brandl | 2010-01-23 09:47:54 +0100 (Sa, 23 Jan 2010) | 1 line

  #7725: fix referencing issue.
........
  r77858 | georg.brandl | 2010-01-30 18:57:48 +0100 (Sa, 30 Jan 2010) | 1 line

  #7802: fix invalid example (heh).
........
  r77887 | georg.brandl | 2010-01-31 19:51:49 +0100 (So, 31 Jan 2010) | 5 lines

  Fix-up ftplib documentation:
  move exception descriptions to toplevel, not inside a class
  remove attribution in "versionadded"
  spell and grammar check docstring of FTP_TLS
........
  r78113 | georg.brandl | 2010-02-08 23:37:20 +0100 (Mo, 08 Feb 2010) | 1 line

  Fix missing string formatting argument.
........
  r78114 | georg.brandl | 2010-02-08 23:37:52 +0100 (Mo, 08 Feb 2010) | 1 line

  Fix undefined local.
........
  r78115 | georg.brandl | 2010-02-08 23:40:51 +0100 (Mo, 08 Feb 2010) | 1 line

  Fix missing string formatting placeholder.
........
  r78117 | georg.brandl | 2010-02-08 23:48:37 +0100 (Mo, 08 Feb 2010) | 1 line

  Convert test failure from output-producing to self.fail().
........
  r78245 | georg.brandl | 2010-02-19 20:36:08 +0100 (Fr, 19 Feb 2010) | 1 line

  #7967: PyXML is no more.
........
  r78385 | georg.brandl | 2010-02-23 22:33:17 +0100 (Di, 23 Feb 2010) | 1 line

  #8000: fix deprecated directive.  What a shame to lose that glorious issue number to such a minor bug :)
........
  r78386 | georg.brandl | 2010-02-23 22:48:57 +0100 (Di, 23 Feb 2010) | 1 line

  #6544: fix refleak in kqueue, occurring in certain error conditions.
........
  r78496 | georg.brandl | 2010-02-27 15:58:08 +0100 (Sa, 27 Feb 2010) | 1 line

  Link to http://www.python.org/dev/workflow/ from bugs page.
........
  r78760 | georg.brandl | 2010-03-07 16:23:59 +0100 (So, 07 Mär 2010) | 1 line

  #5341: more built-in vs builtin fixes.
........
  r78771 | georg.brandl | 2010-03-07 21:58:31 +0100 (So, 07 Mär 2010) | 1 line

  #8085: The function is called PyObject_NewVar, not PyObject_VarNew.
........
  r78772 | georg.brandl | 2010-03-07 22:12:28 +0100 (So, 07 Mär 2010) | 1 line

  #8039: document conditional expressions better, giving them their own section.
........
  r78773 | georg.brandl | 2010-03-07 22:32:06 +0100 (So, 07 Mär 2010) | 1 line

  #8044: document Py_{Enter,Leave}RecursiveCall functions.
........
  r78802 | georg.brandl | 2010-03-08 17:28:40 +0100 (Mo, 08 Mär 2010) | 1 line

  Fix typo.
........
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 4482cd0..141f357 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -429,6 +429,36 @@
    the warning message.
 
 
+Recursion Control
+=================
+
+These two functions provide a way to perform safe recursive calls at the C
+level, both in the core and in extension modules.  They are needed if the
+recursive code does not necessarily invoke Python code (which tracks its
+recursion depth automatically).
+
+.. cfunction:: int Py_EnterRecursiveCall(char *where)
+
+   Marks a point where a recursive C-level call is about to be performed.
+
+   If :const:`USE_STACKCHECK` is defined, this function checks if the the OS
+   stack overflowed using :cfunc:`PyOS_CheckStack`.  In this is the case, it
+   sets a :exc:`MemoryError` and returns a nonzero value.
+
+   The function then checks if the recursion limit is reached.  If this is the
+   case, a :exc:`RuntimeError` is set and a nonzero value is returned.
+   Otherwise, zero is returned.
+
+   *where* should be a string such as ``" in instance check"`` to be
+   concatenated to the :exc:`RuntimeError` message caused by the recursion depth
+   limit.
+
+.. cfunction:: void Py_LeaveRecursiveCall()
+
+   Ends a :cfunc:`Py_EnterRecursiveCall`.  Must be called once for each
+   *successful* invocation of :cfunc:`Py_EnterRecursiveCall`.
+
+
 .. _standardexceptions:
 
 Standard Exceptions
diff --git a/Doc/c-api/gcsupport.rst b/Doc/c-api/gcsupport.rst
index 7fe33b3..4517929 100644
--- a/Doc/c-api/gcsupport.rst
+++ b/Doc/c-api/gcsupport.rst
@@ -31,7 +31,7 @@
 Constructors for container types must conform to two rules:
 
 #. The memory for the object must be allocated using :cfunc:`PyObject_GC_New`
-   or :cfunc:`PyObject_GC_VarNew`.
+   or :cfunc:`PyObject_GC_NewVar`.
 
 #. Once all the fields which may contain references to other containers are
    initialized, it must call :cfunc:`PyObject_GC_Track`.
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 0566375..8489c35 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -189,7 +189,7 @@
    instance; this is normally :cfunc:`PyObject_Del` if the instance was allocated
    using :cfunc:`PyObject_New` or :cfunc:`PyObject_VarNew`, or
    :cfunc:`PyObject_GC_Del` if the instance was allocated using
-   :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_VarNew`.
+   :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar`.
 
    This field is inherited by subtypes.