]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43739: Add type declaration Doc/extending/extending.rst example (GH-25332)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 10 Apr 2021 16:19:11 +0000 (09:19 -0700)
committerGitHub <noreply@github.com>
Sat, 10 Apr 2021 16:19:11 +0000 (09:19 -0700)
Doc/extending/extending.rst
Misc/NEWS.d/next/Documentation/2021-04-06-07-05-49.bpo-43739.L4HjiX.rst [new file with mode: 0644]

index 25dc2934d29ef6fcaba24faa96e21d934dc0b308..bc85a05ff2f850345fdda1b6f3d3ae7cad8a49af 100644 (file)
@@ -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 (file)
index 0000000..9f8d362
--- /dev/null
@@ -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