Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34cafd3

Browse files
Docs: clean up Argument Clinic howto's (#107797)
- fix formatting in @text_signature howto and NEWS entry - fix formatting and example text in deprecate-positionals howto
1 parent 925bbc2 commit 34cafd3

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Doc/howto/clinic.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,13 +1930,14 @@ Example from :source:`Objects/codeobject.c`::
19301930
Return a copy of the code object with new values for the specified fields.
19311931
[clinic start generated output]*/
19321932

1933-
The generated docstring ends up looking like this::
1933+
The generated docstring ends up looking like this:
19341934

1935-
Doc_STRVAR(code_replace__doc__,
1936-
"replace($self, /, **changes)\n"
1937-
"--\n"
1938-
"\n"
1939-
"Return a copy of the code object with new values for the specified fields.");
1935+
.. code-block:: none
1936+
1937+
replace($self, /, **changes)
1938+
--
1939+
1940+
Return a copy of the code object with new values for the specified fields.
19401941
19411942
19421943
.. _clinic-howto-deprecate-positional:
@@ -1968,7 +1969,7 @@ whenever the *b* parameter is passed positionally,
19681969
and we'll be allowed to make it keyword-only in Python 3.14 at the earliest.
19691970

19701971
We can use Argument Clinic to emit the desired deprecation warnings
1971-
using the ``* [from ...]``` syntax,
1972+
using the ``* [from ...]`` syntax,
19721973
by adding the line ``* [from 3.14]`` right above the *b* parameter::
19731974

19741975
/*[clinic input]
@@ -2000,12 +2001,12 @@ Luckily for us, compiler warnings are now generated:
20002001
.. code-block:: none
20012002
20022003
In file included from Modules/foomodule.c:139:
2003-
Modules/clinic/foomodule.c.h:83:8: warning: Update 'b' in 'myfunc' in 'foomodule.c' to be keyword-only. [-W#warnings]
2004-
# warning "Update 'b' in 'myfunc' in 'foomodule.c' to be keyword-only."
2004+
Modules/clinic/foomodule.c.h:139:8: warning: In 'foomodule.c', update parameter(s) 'a' and 'b' in the clinic input of 'mymod.myfunc' to be keyword-only. [-W#warnings]
2005+
# warning "In 'foomodule.c', update parameter(s) 'a' and 'b' in the clinic input of 'mymod.myfunc' to be keyword-only. [-W#warnings]"
20052006
^
20062007
20072008
We now close the deprecation phase by making *b* keyword-only;
2008-
replace the ``* [from ...]``` line above *b*
2009+
replace the ``* [from ...]`` line above *b*
20092010
with the ``*`` from the line above *c*::
20102011

20112012
/*[clinic input]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Argument Clinic now supports overriding automatically generated signature by
2-
using directive `@text_signature`. See :ref:`clinic-howto-override-signature`.
2+
using directive ``@text_signature``. See :ref:`clinic-howto-override-signature`.

0 commit comments

Comments
 (0)