Lines Matching +full:python3 +full:- +full:paste
4 Argument Clinic How-To
19 Currently Argument Clinic is considered internal-only
54 rewrite its code generator to produce tailor-made argument
55 parsing code, rather than calling the general-purpose CPython
85 .. code-block:: shell-session
87 $ python3 Tools/clinic/clinic.py foo.c
92 .. code-block:: none
99 .. code-block:: none
112 .. code-block:: none
167 .. code-block:: none
193 4. Cut the docstring and paste it in between the ``[clinic]`` lines,
213 be a paragraph consisting of a single 80-column line
223 include any sub-modules, and if the function is a method on
272 .. code-block:: none
279 .. code-block:: none
299 string. ("format unit" is the formal name for the one-to-three
303 see :ref:`arg-parsing`.)
306 entire two-or-three character string.
329 takes keyword-only arguments, specify ``*`` on a line by
330 itself before the first keyword-only argument, indented the
338 arguments are positional-only.
340 To mark all parameters as positional-only in Argument Clinic,
344 Currently this is all-or-nothing; either all parameters are
345 positional-only, or none of them are. (In the future Argument
364 11. It's helpful to write a per-parameter docstring for each parameter.
365 But per-parameter docstrings are optional; you can skip this step
368 Here's how to add a per-parameter docstring. The first line
369 of the per-parameter docstring must be indented further than the
371 the left margin for the whole per-parameter docstring; all the text
393 it. With luck everything worked---your block now has output, and
421 13. Double-check that the argument-parsing code Argument Clinic generated
424 First, ensure both places use the same argument-parsing function.
432 as the hand-written one in the existing function, up to the colon
433 or semi-colon.
510 if (self->write == NULL) {
513 Py_TYPE(self)->tp_name);
542 16. Compile, then run the relevant portions of the regression-test suite.
543 This change should not introduce any new compile-time warnings or errors,
544 and there should be no externally-visible change to Python's behavior.
559 -----------------------
574 to allow full expressions like ``CONSTANT - 1``.)
578 -------------------------------------------------------------------
621 --------------------------------------------
626 arguments should be marked positional-only (add a ``/`` on a line by itself
633 ---------------
639 keyword-only arguments.) This approach was used to simulate optional
660 can *only* be used with positional-only parameters.
683 X-coordinate.
685 Y-coordinate.
709 to zero if this group was unused, and set to non-zero if this group was used.
719 * Optional groups can only contain positional-only parameters.
726 ---------------------------------------------------------------------
750 In a nutshell, the syntax for Argument Clinic (non-legacy) converters
756 All arguments to Argument Clinic converters are keyword-only.
775 A set of Python types (and possibly pseudo-types);
777 (This is not a general-purpose facility; as a rule it only supports
890 Just run ``Tools/clinic/clinic.py --converters`` to see the full list.
893 ---------
903 -------------------
926 be hard-coded at Argument-Clinic-preprocessing-time. This limitation is deliberate;
929 hard-coded encoding strings for parameters whose format units start with ``e``.
935 ------------------------
940 .. code-block:: none
946 They can also use any of Python's built-in constants:
948 .. code-block:: none
959 --------------------------
969 ---------------------------------------
974 non-obvious semantics.
978 .. code-block:: none
980 foo: Py_ssize_t = sys.maxsize - 1
983 Argument Clinic can't simply evaluate that expression locally and hard-code it
991 .. code-block:: none
1005 .. code-block:: none
1007 foo: Py_ssize_t(c_default="PY_SSIZE_T_MAX - 1") = sys.maxsize - 1
1027 ------------------------
1036 some C type, then adds code to the generated (non-impl) function to handle converting
1042 they take arguments, the arguments are all keyword-only, and if you're not changing
1049 indicate an error has occurred? Normally, a function returns a valid (non-``NULL``)
1059 .. code-block:: none
1072 None of these take parameters. For the first three, return -1 to indicate
1083 just run ``Tools/clinic/clinic.py --converters`` for the full list.
1087 --------------------------
1101 * their per-parameter docstrings,
1123 Sorry, there's no syntax for partially-cloning a function, or cloning a function
1124 then modifying it. Cloning is an all-or nothing proposition.
1130 -------------------
1158 ------------------------
1210 ----------------------------------
1213 This is useful for :ref:`heap type <heap-types>` methods that need to fetch
1273 --------------------------
1290 parameters *must* be keyword-only. Any arguments passed in to
1321 properly-written code will never actually use this value,
1325 non-empty string.
1364 ---------------------------------
1378 ----------------------------------------------
1382 arguments as positional-only::
1399 ----------------------------------------------
1421 ----------------------------------------
1424 your conventional hand-edited C code. Luckily, Clinic is configurable:
1431 your code attempting to use Clinic-generated code before it is defined.
1436 code to fix definition-before-use problems.)
1446 .. code-block:: none
1469 five built-in destinations:
1492 ``two-pass``
1493 A buffer like ``buffer``. However, a two-pass buffer can only
1505 .. code-block:: none
1511 ``two-pass`` destinations.
1516 .. code-block:: none
1521 supports a special meta-destination, called ``everything``, which tells
1526 .. code-block:: none
1540 ``output preset`` sets Clinic's output to one of several built-in
1577 ``two-pass``
1579 the ``two-pass`` buffer, and definitions to the ``buffer``.
1581 less editing than ``buffer``. Dump the ``two-pass`` buffer
1587 and ``parser_prototype`` to ``two-pass``, write everything else
1590 ``partial-buffer``
1593 This avoids the definition-before-use problem of ``buffer`` completely,
1603 .. code-block:: none
1613 .. code-block:: none
1657 ``two-pass``
1658 A two-pass buffer, like the "two-pass" builtin destination above.
1663 .. code-block:: none
1673 .. code-block:: none
1685 Turns into the string ``/*``, the start-comment text sequence for C files.
1688 Turns into the string ``*/``, the end-comment text sequence for C files.
1693 .. code-block:: none
1704 ----------------------------------------------
1720 .. code-block:: none
1743 .. code-block:: none
1774 .. code-block:: none
1786 -------------------------------------
1796 .. code-block:: python3