Skip to content

Commit a17458a

Browse files
encukoudnicolodiZeroIntensity
authored
Apply suggestions from code review
Co-authored-by: Daniele Nicolodi <daniele@grinta.net> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent f92562c commit a17458a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Doc/extending/first-extension-module.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Then, create ``meson.build`` containing the following:
146146

147147
.. code-block:: meson
148148
149-
project('purelib-and-platlib', 'c')
149+
project('sampleproject', 'c')
150150
151151
py = import('python').find_installation(pure: false)
152152
@@ -309,9 +309,9 @@ To expose the ``system`` C function directly to Python,
309309
we'll need to write a layer of glue code to convert arguments from Python
310310
objects to C values, and the C return value back to Python.
311311

312-
One of the simplest glue code is a ":c:data:`METH_O`" function,
312+
One of the simplest ways to write glue code is a ":c:data:`METH_O`" function,
313313
which takes two Python objects and returns one.
314-
All Pyton objects -- regardless of the Python type -- are represented in C
314+
All Python objects -- regardless of the Python type -- are represented in C
315315
as pointers to the ``PyObject`` structure.
316316

317317
Add such a function above the slots array::
@@ -322,7 +322,7 @@ Add such a function above the slots array::
322322
Py_RETURN_NONE;
323323
}
324324

325-
For now, we'll ignor the arguments, and use the :c:macro:`Py_RETURN_NONE`
325+
For now, we'll ignore the arguments, and use the :c:macro:`Py_RETURN_NONE`
326326
macro to properly ``return`` a Python :py:data:`None` object.
327327

328328
Recompile your extension to make sure you don't have syntax errors.
@@ -366,7 +366,7 @@ Add a :c:data:`Py_mod_methods` slot to your a :c:type:`PyMethodDef` array:
366366

367367
Recompile your extension again, and test it.
368368
Be sure to restart the Python interpreter, so that ``import spam`` picks
369-
up the new version if the module.
369+
up the new version of the module.
370370

371371
You should now be able to call the function:
372372

@@ -441,10 +441,10 @@ object.
441441
This isn't useful in our case, so we'll ignore it.
442442

443443
The other one, ``PyObject *arg``, will be set to the object that the user
444-
called the Python with.
444+
passed from Python.
445445
We expect that it should be a Python string.
446446
In order to use the information in it, we will need
447-
to convert it to a C value --- in this case, a C string (``const char *``).
447+
to convert it to a C value -- in this case, a C string (``const char *``).
448448

449449
There's a slight type mismatch here: Python's :py:class:`str` objects store
450450
Unicode text, but C strings are arrays of bytes.

0 commit comments

Comments
 (0)