Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c89a6f

Browse files
committed
use PyMac_GetArgv (in macgetargv.c) for applet inits
1 parent dbfb282 commit 8c89a6f

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

Mac/Python/macglue.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -748,21 +748,10 @@ PyMac_BuildEventRecord(EventRecord *e)
748748
}
749749

750750

751-
/* What follows is used only by applets. */
752-
753-
static void
754-
init_mac_world()
755-
{
756-
MaxApplZone();
757-
InitGraf(&qd.thePort);
758-
InitFonts();
759-
InitWindows();
760-
TEInit();
761-
InitDialogs((long)0);
762-
InitMenus();
763-
InitCursor();
764-
}
751+
/* ---------- */
752+
/* Applet support */
765753

754+
/* Run a compiled Python Python script from 'PYC ' resource __main__ */
766755
static int
767756
run_main_resource()
768757
{
@@ -795,14 +784,16 @@ run_main_resource()
795784
return 0;
796785
}
797786

787+
/* Initialization sequence for applets */
798788
void
799789
PyMac_InitApplet()
800790
{
801-
static char *argv[] = {"__main__", NULL};
791+
int argc;
792+
char **argv;
802793

803-
init_mac_world();
794+
argc = PyMac_GetArgv(&argv);
804795
Py_Initialize();
805-
PySys_SetArgv((sizeof argv / sizeof argv[0]) - 1, argv);
796+
PySys_SetArgv(argc, argv);
806797
run_main_resource();
807798
fflush(stderr);
808799
fflush(stdout);

0 commit comments

Comments
 (0)