summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-07-12 13:17:59 (GMT)
committerGeorg Brandl <georg@python.org>2005-07-12 13:17:59 (GMT)
commit9abfa90a6ddd0ec00060bc371c62bcdae42aceaf (patch)
tree94cdc200b8c741a85772fabac0b2b81afa6c7e84
parent0edc7a03e2505c4e9b3186f8b6caa18a7b3988e2 (diff)
downloadcpython-9abfa90a6ddd0ec00060bc371c62bcdae42aceaf.zip
cpython-9abfa90a6ddd0ec00060bc371c62bcdae42aceaf.tar.gz
cpython-9abfa90a6ddd0ec00060bc371c62bcdae42aceaf.tar.bz2
bug [ 1232768 ] Mistakes in online docs under "5.3 Pure Embedding"
-rw-r--r--Doc/ext/run-func.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Doc/ext/run-func.c b/Doc/ext/run-func.c
index b5be5c6..ff74290 100644
--- a/Doc/ext/run-func.c
+++ b/Doc/ext/run-func.c
@@ -20,11 +20,8 @@ main(int argc, char *argv[])
Py_DECREF(pName);
if (pModule != NULL) {
- pDict = PyModule_GetDict(pModule);
- /* pDict is a borrowed reference */
-
- pFunc = PyDict_GetItemString(pDict, argv[2]);
- /* pFun: Borrowed reference */
+ pFunc = PyDict_GetItemString(pModule, argv[2]);
+ /* pFunc is a new reference */
if (pFunc && PyCallable_Check(pFunc)) {
pArgs = PyTuple_New(argc - 3);
@@ -46,18 +43,19 @@ main(int argc, char *argv[])
Py_DECREF(pValue);
}
else {
+ Py_DECREF(pFunc);
Py_DECREF(pModule);
PyErr_Print();
fprintf(stderr,"Call failed\n");
return 1;
}
- /* pDict and pFunc are borrowed and must not be Py_DECREF-ed */
}
else {
if (PyErr_Occurred())
PyErr_Print();
fprintf(stderr, "Cannot find function \"%s\"\n", argv[2]);
}
+ Py_XDECREF(pFunc);
Py_DECREF(pModule);
}
else {