summaryrefslogtreecommitdiffstats
path: root/Demo/embed
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-03-09 17:07:24 (GMT)
committerGuido van Rossum <guido@python.org>1999-03-09 17:07:24 (GMT)
commit496bc7f2384a8e203fe3c56e1b87a8055787a793 (patch)
tree053f4fe6e26d0c9e7aa5f860f3435ff34632b2bb /Demo/embed
parenteb894ebd0adf603efaa1b339bf6403de3850d8ff (diff)
downloadcpython-496bc7f2384a8e203fe3c56e1b87a8055787a793.zip
cpython-496bc7f2384a8e203fe3c56e1b87a8055787a793.tar.gz
cpython-496bc7f2384a8e203fe3c56e1b87a8055787a793.tar.bz2
Call Py_SetProgramName() instead of redefining getprogramname(),
reflecting changes in the runtime around 1.5 or earlier.
Diffstat (limited to 'Demo/embed')
-rw-r--r--Demo/embed/demo.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c
index 9a1883f..579ba07 100644
--- a/Demo/embed/demo.c
+++ b/Demo/embed/demo.c
@@ -2,16 +2,14 @@
#include "Python.h"
-static char *argv0;
-
void initxyzzy(); /* Forward */
main(argc, argv)
int argc;
char **argv;
{
- /* Save a copy of argv0 */
- argv0 = argv[0];
+ /* Pass argv[0] to the Python interpreter */
+ Py_SetProgramName(argv[0]);
/* Initialize the Python interpreter. Required. */
Py_Initialize();
@@ -32,6 +30,7 @@ main(argc, argv)
PyRun_SimpleString("import sys\n");
PyRun_SimpleString("print sys.builtin_module_names\n");
PyRun_SimpleString("print sys.modules.keys()\n");
+ PyRun_SimpleString("print sys.executable\n");
PyRun_SimpleString("print sys.argv\n");
/* Note that you can call any public function of the Python
@@ -45,13 +44,6 @@ main(argc, argv)
/*NOTREACHED*/
}
-/* This function is called by the interpreter to get its own name */
-char *
-getprogramname()
-{
- return argv0;
-}
-
/* A static module */
static PyObject *