summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-06 07:59:52 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-06 07:59:52 (GMT)
commit16215c732c4c40b6c2555db6083feaaa2f6f5d7b (patch)
tree45d3572a105a3887c3737fb982dc5f1db367ec04 /Doc/c-api
parentd6abb72a79ba2bc1b9570c1f344fdeff5ca2f6bd (diff)
downloadcpython-16215c732c4c40b6c2555db6083feaaa2f6f5d7b.zip
cpython-16215c732c4c40b6c2555db6083feaaa2f6f5d7b.tar.gz
cpython-16215c732c4c40b6c2555db6083feaaa2f6f5d7b.tar.bz2
Merged revisions 78959,79170,79175,79177,79180,79183,79186,79193,79581 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r78959 | georg.brandl | 2010-03-14 11:56:14 +0100 (So, 14 Mär 2010) | 33 lines Merged revisions 78760,78771-78773,78802,78922,78952 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ 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. ........ r78922 | georg.brandl | 2010-03-13 14:41:58 +0100 (Sa, 13 Mär 2010) | 1 line Update for new download location. ........ r78952 | georg.brandl | 2010-03-14 10:55:08 +0100 (So, 14 Mär 2010) | 1 line #8137: add iso-8859-16 to the standard encodings table. ........ ................ r79170 | georg.brandl | 2010-03-21 10:02:59 +0100 (So, 21 Mär 2010) | 1 line Fix some issues found by Jacques Ducasse on the docs list. ................ r79175 | georg.brandl | 2010-03-21 10:10:32 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79172 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79172 | georg.brandl | 2010-03-21 10:08:00 +0100 (So, 21 Mär 2010) | 1 line Add a paragraph about set displays. ........ ................ r79177 | georg.brandl | 2010-03-21 10:25:54 +0100 (So, 21 Mär 2010) | 1 line Need to use list(range()) to get a list. ................ r79180 | georg.brandl | 2010-03-21 10:50:49 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79178 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79178 | georg.brandl | 2010-03-21 10:28:16 +0100 (So, 21 Mär 2010) | 1 line Clarify that for shell=True, the shell PID will be the child PID. ........ ................ r79183 | georg.brandl | 2010-03-21 10:52:24 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79181 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79181 | georg.brandl | 2010-03-21 10:51:16 +0100 (So, 21 Mär 2010) | 1 line Update os.kill() emulation example for Windows to use ctypes. ........ ................ r79186 | georg.brandl | 2010-03-21 11:03:36 +0100 (So, 21 Mär 2010) | 13 lines Merged revisions 79184-79185 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79184 | georg.brandl | 2010-03-21 10:58:36 +0100 (So, 21 Mär 2010) | 1 line Update text for newest US DST regulation. The sample file already has the calculation right. ........ r79185 | georg.brandl | 2010-03-21 11:02:47 +0100 (So, 21 Mär 2010) | 1 line Include structmember.h correctly. ........ ................ r79193 | georg.brandl | 2010-03-21 12:53:50 +0100 (So, 21 Mär 2010) | 9 lines Merged revisions 79192 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79192 | georg.brandl | 2010-03-21 12:50:58 +0100 (So, 21 Mär 2010) | 1 line Remove leftover word. ........ ................ r79581 | georg.brandl | 2010-04-02 10:47:07 +0200 (Fr, 02 Apr 2010) | 1 line #8213: document behavior of -u on py3k better. ................
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/exceptions.rst30
-rw-r--r--Doc/c-api/gcsupport.rst2
-rw-r--r--Doc/c-api/typeobj.rst2
3 files changed, 32 insertions, 2 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 819e22e..2214c4d 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -446,6 +446,36 @@ Exception Objects
This steals a reference to *ctx*.
+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 4f4d27d..1a280c8 100644
--- a/Doc/c-api/gcsupport.rst
+++ b/Doc/c-api/gcsupport.rst
@@ -28,7 +28,7 @@ include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
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 378bfe1..eb8a83e 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -182,7 +182,7 @@ type objects) *must* have the :attr:`ob_size` field.
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.