@@ -27,7 +27,8 @@ Argument Clinic How-To
2727 version of Argument Clinic that ships with the next version
2828 of CPython *could * be totally incompatible and break all your code.
2929
30- The Goals Of Argument Clinic
30+
31+ The goals of Argument Clinic
3132============================
3233
3334Argument Clinic's primary goal
@@ -78,7 +79,7 @@ and it should be able to do many interesting and smart
7879things with all the information you give it.
7980
8081
81- Basic Concepts And Usage
82+ Basic concepts and usage
8283========================
8384
8485Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py ``.
@@ -141,7 +142,7 @@ For the sake of clarity, here's the terminology we'll use with Argument Clinic:
141142 a block.)
142143
143144
144- Converting Your First Function
145+ Converting your first function
145146==============================
146147
147148The best way to get a sense of how Argument Clinic works is to
@@ -558,7 +559,8 @@ Let's dive in!
558559
559560 Congratulations, you've ported your first function to work with Argument Clinic!
560561
561- Advanced Topics
562+
563+ Advanced topics
562564===============
563565
564566Now that you've had some experience working with Argument Clinic, it's time
@@ -636,7 +638,8 @@ after the last argument).
636638Currently the generated code will use :c:func: `PyArg_ParseTuple `, but this
637639will change soon.
638640
639- Optional Groups
641+
642+ Optional groups
640643---------------
641644
642645Some legacy functions have a tricky approach to parsing their arguments:
@@ -899,6 +902,7 @@ available. For each converter it'll show you all the parameters
899902it accepts, along with the default value for each parameter.
900903Just run ``Tools/clinic/clinic.py --converters `` to see the full list.
901904
905+
902906Py_buffer
903907---------
904908
@@ -908,7 +912,6 @@ you *must* not call :c:func:`PyBuffer_Release` on the provided buffer.
908912Argument Clinic generates code that does it for you (in the parsing function).
909913
910914
911-
912915Advanced converters
913916-------------------
914917
@@ -975,6 +978,7 @@ value called ``NULL`` for just this reason: from Python's perspective it
975978behaves like a default value of ``None ``, but the C variable is initialized
976979with ``NULL ``.
977980
981+
978982Expressions specified as default values
979983---------------------------------------
980984
@@ -1032,7 +1036,6 @@ you're not permitted to use:
10321036* Tuple/list/set/dict literals.
10331037
10341038
1035-
10361039Using a return converter
10371040------------------------
10381041
@@ -1146,6 +1149,7 @@ then modifying it. Cloning is an all-or nothing proposition.
11461149Also, the function you are cloning from must have been previously defined
11471150in the current file.
11481151
1152+
11491153Calling Python code
11501154-------------------
11511155
@@ -1380,6 +1384,7 @@ handle initialization and cleanup.
13801384You can see more examples of custom converters in the CPython
13811385source tree; grep the C files for the string ``CConverter ``.
13821386
1387+
13831388Writing a custom return converter
13841389---------------------------------
13851390
@@ -1394,8 +1399,9 @@ write your own return converter, please read ``Tools/clinic/clinic.py``,
13941399specifically the implementation of ``CReturnConverter `` and
13951400all its subclasses.
13961401
1402+
13971403METH_O and METH_NOARGS
1398- ----------------------------------------------
1404+ ----------------------
13991405
14001406To convert a function using ``METH_O ``, make sure the function's
14011407single argument is using the ``object `` converter, and mark the
@@ -1415,8 +1421,9 @@ any arguments.
14151421You can still use a self converter, a return converter, and specify
14161422a ``type `` argument to the object converter for ``METH_O ``.
14171423
1424+
14181425tp_new and tp_init functions
1419- ----------------------------------------------
1426+ ----------------------------
14201427
14211428You can convert ``tp_new `` and ``tp_init `` functions. Just name
14221429them ``__new__ `` or ``__init__ `` as appropriate. Notes:
@@ -1437,6 +1444,7 @@ them ``__new__`` or ``__init__`` as appropriate. Notes:
14371444 (If your function doesn't support keywords, the parsing function
14381445 generated will throw an exception if it receives any.)
14391446
1447+
14401448Changing and redirecting Clinic's output
14411449----------------------------------------
14421450
@@ -1721,7 +1729,7 @@ the file was not modified by hand before it gets overwritten.
17211729
17221730
17231731The #ifdef trick
1724- ----------------------------------------------
1732+ ----------------
17251733
17261734If you're converting a function that isn't available on all platforms,
17271735there's a trick you can use to make life a little easier. The existing
@@ -1801,7 +1809,6 @@ Argument Clinic added to your file (it'll be at the very bottom), then
18011809move it above the ``PyMethodDef `` structure where that macro is used.
18021810
18031811
1804-
18051812Using Argument Clinic in Python files
18061813-------------------------------------
18071814
0 commit comments