Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move signature check up
  • Loading branch information
encukou committed Dec 12, 2025
commit 7069412a13258857ba552c42d76b180cb67d614e
15 changes: 10 additions & 5 deletions Doc/extending/first-extension-module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ You should now be able to call the function:
Note that our ``spam.system`` does not yet run the ``whoami`` command;
Comment thread
ZeroIntensity marked this conversation as resolved.
it only returns ``None``.

Check that the function accepts exactly one argument, as specified by
the :c:data:`METH_O` flag:

.. code-block:: pycon

>>> print(spam.system('too', 'many', 'arguments'))
Comment thread
ZeroIntensity marked this conversation as resolved.
Traceback (most recent call last):
...
TypeError: spam.system() takes exactly one argument (3 given)


Returning an integer
====================
Expand Down Expand Up @@ -495,11 +505,6 @@ You might also want to test error cases:
...
TypeError: bad argument type for built-in operation

>>> print(spam.system('too', 'many', 'arguments'))
Traceback (most recent call last):
...
TypeError: spam.system() takes exactly one argument (3 given)


The result
==========
Expand Down
Loading