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

Skip to content

Commit a277c13

Browse files
committed
Issue 28753: Argument Clinic howto docfix, courtesy Julien Palard.
1 parent 932d40a commit a277c13

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

Doc/howto/clinic.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,12 @@ Let's dive in!
375375
Write a pickled representation of obj to the open file.
376376
[clinic start generated code]*/
377377

378-
12. Save and close the file, then run ``Tools/clinic/clinic.py`` on it.
379-
With luck everything worked and your block now has output! Reopen
380-
the file in your text editor to see::
378+
12. Save and close the file, then run ``Tools/clinic/clinic.py`` on
379+
it. With luck everything worked---your block now has output, and
380+
a ``.c.h`` file has been generated! Reopen the file in your
381+
text editor to see:
381382

382-
/*[clinic input]
383-
module _pickle
384-
class _pickle.Pickler "PicklerObject *" "&Pickler_Type"
385-
[clinic start generated code]*/
386-
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
383+
.. code-block:: c
387384
388385
/*[clinic input]
389386
_pickle.Pickler.dump
@@ -395,18 +392,22 @@ Let's dive in!
395392
Write a pickled representation of obj to the open file.
396393
[clinic start generated code]*/
397394
398-
PyDoc_STRVAR(_pickle_Pickler_dump__doc__,
399-
"Write a pickled representation of obj to the open file.\n"
400-
"\n"
401-
...
402395
static PyObject *
403-
_pickle_Pickler_dump_impl(PicklerObject *self, PyObject *obj)
404-
/*[clinic end generated code: checksum=3bd30745bf206a48f8b576a1da3d90f55a0a4187]*/
396+
_pickle_Pickler_dump(PicklerObject *self, PyObject *obj)
397+
/*[clinic end generated code: output=87ecad1261e02ac7 input=552eb1c0f52260d9]*/
405398
406399
Obviously, if Argument Clinic didn't produce any output, it's because
407400
it found an error in your input. Keep fixing your errors and retrying
408401
until Argument Clinic processes your file without complaint.
409402

403+
For readability, most of the glue code has been generated to a ``.c.h``
404+
file. You'll need to include that in your original ``.c`` file,
405+
typically right after the clinic module block:
406+
407+
.. code-block:: c
408+
409+
#include "clinic/_pickle.c.h"
410+
410411
13. Double-check that the argument-parsing code Argument Clinic generated
411412
looks basically the same as the existing code.
412413

0 commit comments

Comments
 (0)