summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-09-14 13:31:04 (GMT)
committerGuido van Rossum <guido@python.org>1994-09-14 13:31:04 (GMT)
commitfdef2715503a56aa02716ee4bd0afcd431ba7c25 (patch)
treefd95ea8cdc7434e3cf3f4c4d82657c50ea9a97a3 /Python/import.c
parent956640880da20c20d5320477a0dcaf2026bd9426 (diff)
downloadcpython-fdef2715503a56aa02716ee4bd0afcd431ba7c25.zip
cpython-fdef2715503a56aa02716ee4bd0afcd431ba7c25.tar.gz
cpython-fdef2715503a56aa02716ee4bd0afcd431ba7c25.tar.bz2
* Import/pythonrun.h, Python/{import,pythonrun}.c,
mac/macsetfiletype.c: changes by Jack to execute .pyc file passed as command line argument. On the Mac .pyc files are given a special type so they can be double-clicked
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 1a13fcf..f655041 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -176,6 +176,14 @@ static object *modules;
/* Forward */
static int init_builtin PROTO((char *));
+/* Helper for reading .pyc files */
+
+long
+get_pyc_magic()
+{
+ return MAGIC;
+}
+
/* Initialization */
void
@@ -482,6 +490,9 @@ get_module(m, name, m_ret)
/* Now write the code object to the ".pyc" file */
strcpy(namebuf + len, "c");
fpc = fopen(namebuf, "wb");
+#ifdef macintosh
+ setfiletype(namebuf, 'PYTH', 'PYC ');
+#endif
if (fpc == NULL) {
if (verbose)
fprintf(stderr,