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

This commit is contained in:
Shreyan Avigyan 2021-04-10 21:24:32 +05:30 committed by GitHub
parent dccdc500f9
commit ea9b2d6319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View 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");

View File

@ -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.