8000 Add "how to" for the getter Argument Clinic directive. by corona10 · Pull Request #1232 · python/devguide · GitHub
[go: up one dir, main page]

Skip to content

Add "how to" for the getter Argument Clinic directive. #1232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 30, 2023
Merged
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
  • Loading branch information
corona10 and hugovk authored Nov 27, 2023
commit 97e644e19522b1f1e6051a2d2e4968e6aaad32d5
12 changes: 6 additions & 6 deletions development-tools/clinic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2003,11 +2003,11 @@ The generated glue code looks like this:

.. _clinic-howto-getter:

How to generate getter with Argument Clinic
--------------------------------------------
How to generate a getter
------------------------

You can use ``@getter`` directive to generate "impl" function
to defining getter.
You can use the ``@getter`` directive to generate an "impl" function
to define a getter.

Example from :cpy-file:`Modules/_io/bufferedio.c`::

Expand All @@ -2017,8 +2017,8 @@ Example from :cpy-file:`Modules/_io/bufferedio.c`::
_io._Buffered.closed
[clinic start generated code]*/

The generate glue code looks like this.
Note that this example is mixture usage with ``@critical_section`` directive
The generated glue code looks like this.
Note that this example is a mixture using the ``@critical_section`` directive
to achieve thread safety without causing deadlocks between threads:

.. code-block:: c
Expand Down
0