You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Doc/howto/clinic.rst
+11-10Lines changed: 11 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1930,13 +1930,14 @@ Example from :source:`Objects/codeobject.c`::
1930
1930
Return a copy of the code object with new values for the specified fields.
1931
1931
[clinic start generated output]*/
1932
1932
1933
-
The generated docstring ends up looking like this::
1933
+
The generated docstring ends up looking like this:
1934
1934
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.
1940
1941
1941
1942
1942
1943
.. _clinic-howto-deprecate-positional:
@@ -1968,7 +1969,7 @@ whenever the *b* parameter is passed positionally,
1968
1969
and we'll be allowed to make it keyword-only in Python 3.14 at the earliest.
1969
1970
1970
1971
We can use Argument Clinic to emit the desired deprecation warnings
1971
-
using the ``* [from ...]``` syntax,
1972
+
using the ``* [from ...]`` syntax,
1972
1973
by adding the line ``* [from 3.14]`` right above the *b* parameter::
1973
1974
1974
1975
/*[clinic input]
@@ -2000,12 +2001,12 @@ Luckily for us, compiler warnings are now generated:
2000
2001
.. code-block:: none
2001
2002
2002
2003
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]"
2005
2006
^
2006
2007
2007
2008
We now close the deprecation phase by making *b* keyword-only;
0 commit comments