summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-02-24 23:07:04 +0000
committerJack Jansen <jack.jansen@cwi.nl>2002-02-24 23:07:04 +0000
commit11c8a87da0704066189e57a90e3d377fd9bdf7d6 (patch)
treee233b5fd3e918fbbd0c95967575fc30bec6b7fec
parent2b959a83ef916a1b97ab70831fefa3194f9aa0ea (diff)
downloadcpython-git-11c8a87da0704066189e57a90e3d377fd9bdf7d6.tar.gz
bqackport of 1.73:
In MachoPython, don't simulate argc/argv unless we have argc=1 and argv[1] starts with "-psn_". This means the drag-and-drop continues to work as expected, but we can now also do /Applications/Python.app/Contents/MacOS/python script.py from the command line, which is a lot easier with debugging. Pressing <option> at this point also has the expected effect of opening the options dialog!
-rw-r--r--Mac/Python/macmain.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c
index b86b52847f..71b42e9e92 100644
--- a/Mac/Python/macmain.c
+++ b/Mac/Python/macmain.c
@@ -316,8 +316,14 @@ init_common(int *argcp, char ***argvp, int embedded)
*argcp = 1;
*argvp = emb_argv;
} else {
- /* Create argc/argv. Do it before we go into the options event loop. */
- *argcp = PyMac_GetArgv(argvp, PyMac_options.noargs);
+ /* Create argc/argv. Do it before we go into the options event loop.
+ ** In MachoPython we skip this step if we already have plausible
+ ** command line arguments.
+ */
+#if TARGET_API_MAC_OSX
+ if (*argcp == 2 && strncmp((*argvp)[1], "-psn_", 5) == 0)
+#endif
+ *argcp = PyMac_GetArgv(argvp, PyMac_options.noargs);
#if !TARGET_API_MAC_OSX
#ifndef NO_ARGV0_CHDIR
if (*argcp >= 1 && (*argvp)[0] && (*argvp)[0][0]) {