[Python-checkins] bpo-43739: Add type declaration Doc/extending/extending.rst example

rhettinger webhook-mailer at python.org
Sat Apr 10 11:54:44 EDT 2021


https://github.com/python/cpython/commit/ea9b2d631902238acf69e51af6e3d308567b5dfd
commit: ea9b2d631902238acf69e51af6e3d308567b5dfd
branch: master
author: Shreyan Avigyan <shreyan.avigyan at gmail.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2021-04-10T08:54:32-07:00
summary:

bpo-43739: Add type declaration Doc/extending/extending.rst example

files:
A Misc/NEWS.d/next/Documentation/2021-04-06-07-05-49.bpo-43739.L4HjiX.rst
M Doc/extending/extending.rst

diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index 25dc2934d29ef..bc85a05ff2f85 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -410,7 +410,7 @@ optionally followed by an import of the module::
        /* Optionally import the module; alternatively,
           import can be deferred until the embedded script
           imports it. */
-       pmodule = PyImport_ImportModule("spam");
+       PyObject *pmodule = PyImport_ImportModule("spam");
        if (!pmodule) {
            PyErr_Print();
            fprintf(stderr, "Error: could not import module 'spam'\n");
diff --git a/Misc/NEWS.d/next/Documentation/2021-04-06-07-05-49.bpo-43739.L4HjiX.rst b/Misc/NEWS.d/next/Documentation/2021-04-06-07-05-49.bpo-43739.L4HjiX.rst
new file mode 100644
index 0000000000000..9f8d3625e7961
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-04-06-07-05-49.bpo-43739.L4HjiX.rst
@@ -0,0 +1 @@
+Fixing the example code in Doc/extending/extending.rst to declare and initialize the pmodule variable to be of the right type.
\ No newline at end of file



More information about the Python-checkins mailing list