Getting rid of all the code inside #ifdef macintosh too.
diff --git a/Python/ceval.c b/Python/ceval.c
index df6f0e9..f198da1 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -14,10 +14,6 @@
#include "opcode.h"
#include "structmember.h"
-#ifdef macintosh
-#include "macglue.h"
-#endif
-
#include <ctype.h>
/* Turn this on if your compiler chokes on the big switch: */
@@ -801,7 +797,7 @@
goto on_error;
}
}
-#if !defined(HAVE_SIGNAL_H) || defined(macintosh)
+#if !defined(HAVE_SIGNAL_H)
/* If we have true signals, the signal handler
will call Py_AddPendingCall() so we don't
have to call PyErr_CheckSignals(). On the
diff --git a/Python/errors.c b/Python/errors.c
index 4d88d2d..6416ff3 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -3,12 +3,6 @@
#include "Python.h"
-#ifdef macintosh
-extern char *PyMac_StrError(int);
-#undef strerror
-#define strerror PyMac_StrError
-#endif /* macintosh */
-
#ifndef __STDC__
#ifndef MS_WINDOWS
extern char *strerror(int);
diff --git a/Python/import.c b/Python/import.c
index 50b28ef..77a5605 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -11,9 +11,6 @@
#include "eval.h"
#include "osdefs.h"
#include "importdl.h"
-#ifdef macintosh
-#include "macglue.h"
-#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@@ -835,9 +832,6 @@
fclose(fp);
if (Py_VerboseFlag)
PySys_WriteStderr("# wrote %s\n", cpathname);
-#ifdef macintosh
- PyMac_setfiletype(cpathname, 'Pyth', 'PYC ');
-#endif
}
@@ -1123,13 +1117,6 @@
strcat(buf, ".");
strcat(buf, name);
strcpy(name, buf);
-#ifdef macintosh
- /* Freezing on the mac works different, and the modules are
- ** actually on sys.path. So we don't take the quick exit but
- ** continue with the normal flow.
- */
- path = NULL;
-#else
if (find_frozen(name) != NULL) {
strcpy(buf, name);
return &fd_frozen;
@@ -1137,7 +1124,6 @@
PyErr_Format(PyExc_ImportError,
"No frozen submodule named %.200s", name);
return NULL;
-#endif
}
if (path == NULL) {
if (is_builtin(name)) {
@@ -1233,33 +1219,6 @@
/* no hook was successful, use builtin import */
}
-#ifdef macintosh
- /*
- ** Speedup: each sys.path item is interned, and
- ** FindResourceModule remembers which items refer to
- ** folders (so we don't have to bother trying to look
- ** into them for resources). We only do this for string
- ** items.
- */
- if (PyString_Check(PyList_GET_ITEM(path, i))) {
- PyString_InternInPlace(&PyList_GET_ITEM(path, i));
- v = PyList_GET_ITEM(path, i);
- if (PyMac_FindResourceModule((PyStringObject *)v, name, buf)) {
- static struct filedescr resfiledescr =
- {"", "", PY_RESOURCE};
-
- Py_XDECREF(copy);
- return &resfiledescr;
- }
- if (PyMac_FindCodeResourceModule((PyStringObject *)v, name, buf)) {
- static struct filedescr resfiledescr =
- {"", "", PY_CODERESOURCE};
-
- Py_XDECREF(copy);
- return &resfiledescr;
- }
- }
-#endif
if (len > 0 && buf[len-1] != SEP
#ifdef ALTSEP
&& buf[len-1] != ALTSEP
@@ -1290,10 +1249,6 @@
}
#endif
#endif
-#ifdef macintosh
- fdp = PyMac_FindModuleExtension(buf, &len, name);
- if (fdp) {
-#else
#if defined(PYOS_OS2)
/* take a snapshot of the module spec for restoration
* after the 8 character DLL hackery
@@ -1331,7 +1286,6 @@
strcpy(buf+len, fdp->suffix);
if (Py_VerboseFlag > 1)
PySys_WriteStderr("# trying %s\n", buf);
-#endif /* !macintosh */
filemode = fdp->mode;
if (filemode[0] == 'U')
filemode = "r" PY_STDIOTEXTMODE;
@@ -1408,9 +1362,6 @@
#elif defined(DJGPP)
#include <dir.h>
-#elif defined(macintosh)
-#include <TextUtils.h>
-
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
#include <sys/types.h>
#include <dirent.h>
@@ -1475,24 +1426,6 @@
}
return strncmp(ffblk.ff_name, name, namelen) == 0;
-/* macintosh */
-#elif defined(macintosh)
- FSSpec fss;
- OSErr err;
-
- if (Py_GETENV("PYTHONCASEOK") != NULL)
- return 1;
-
- err = FSMakeFSSpec(0, 0, Pstring(buf), &fss);
- if (err) {
- PyErr_Format(PyExc_NameError,
- "Can't find file for module %.100s\n(filename %.300s)",
- name, buf);
- return 0;
- }
- return fss.name[0] >= namelen &&
- strncmp(name, (char *)fss.name+1, namelen) == 0;
-
/* new-fangled macintosh (macosx) */
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
DIR *dirp;
@@ -1709,15 +1642,6 @@
break;
#endif
-#ifdef macintosh
- case PY_RESOURCE:
- m = PyMac_LoadResourceModule(name, buf);
- break;
- case PY_CODERESOURCE:
- m = PyMac_LoadCodeResourceModule(name, buf);
- break;
-#endif
-
case PKG_DIRECTORY:
m = load_package(name, buf);
break;
@@ -2678,21 +2602,6 @@
return m;
}
-#ifdef macintosh
-static PyObject *
-imp_load_resource(PyObject *self, PyObject *args)
-{
- char *name;
- char *pathname;
- PyObject *m;
-
- if (!PyArg_ParseTuple(args, "ss:load_resource", &name, &pathname))
- return NULL;
- m = PyMac_LoadResourceModule(name, pathname);
- return m;
-}
-#endif /* macintosh */
-
static PyObject *
imp_load_module(PyObject *self, PyObject *args)
{
@@ -2822,9 +2731,6 @@
{"load_dynamic", imp_load_dynamic, METH_VARARGS},
#endif
{"load_package", imp_load_package, METH_VARARGS},
-#ifdef macintosh
- {"load_resource", imp_load_resource, METH_VARARGS},
-#endif
{"load_source", imp_load_source, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index c09a3ff..ed54ab3 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -27,9 +27,6 @@
#include "windows.h"
#endif
-#ifdef macintosh
-#include "macglue.h"
-#endif
extern char *Py_GetPath(void);
extern grammar _PyParser_Grammar; /* From graminit.c */
@@ -755,13 +752,6 @@
if (strcmp(ext, ".pyc") == 0 || strcmp(ext, ".pyo") == 0)
return 1;
-#ifdef macintosh
- /* On a mac, we also assume a pyc file for types 'PYC ' and 'APPL' */
- if (PyMac_getfiletype((char *)filename) == 'PYC '
- || PyMac_getfiletype((char *)filename) == 'APPL')
- return 1;
-#endif /* macintosh */
-
/* Only look into the file if we are allowed to close it, since
it then should also be seekable. */
if (closeit) {
@@ -1542,11 +1532,7 @@
{
Py_Finalize();
-#ifdef macintosh
- PyMac_Exit(sts);
-#else
exit(sts);
-#endif
}
static void
diff --git a/Python/strerror.c b/Python/strerror.c
index aeb7dd5..55f8342 100644
--- a/Python/strerror.c
+++ b/Python/strerror.c
@@ -17,8 +17,3 @@
PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
return buf;
}
-
-#ifdef macintosh
-int sys_nerr = 0;
-char *sys_errlist[1] = 0;
-#endif
diff --git a/Python/structmember.c b/Python/structmember.c
index 34310b8..bbaaca8 100644
--- a/Python/structmember.c
+++ b/Python/structmember.c
@@ -103,23 +103,6 @@
case T_STRING_INPLACE:
v = PyString_FromString((char*)addr);
break;
-#ifdef macintosh
- case T_PSTRING:
- if (*(char**)addr == NULL) {
- Py_INCREF(Py_None);
- v = Py_None;
- }
- else
- v = PyString_FromStringAndSize(
- (*(char**)addr)+1,
- **(unsigned char**)addr);
- break;
- case T_PSTRING_INPLACE:
- v = PyString_FromStringAndSize(
- ((char*)addr)+1,
- *(unsigned char*)addr);
- break;
-#endif /* macintosh */
case T_CHAR:
v = PyString_FromStringAndSize((char*)addr, 1);
break;
@@ -168,11 +151,7 @@
{
PyObject *oldv;
- if ((l->flags & READONLY) || l->type == T_STRING
-#ifdef macintosh
- || l->type == T_PSTRING
-#endif
- )
+ if ((l->flags & READONLY) || l->type == T_STRING)
{
PyErr_SetString(PyExc_TypeError, "readonly attribute");
return -1;