]> granicus.if.org Git - python/commitdiff
MacPython-OS9 specific fix: If there are non-string items on sys.path don't try to...
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 24 Jan 2003 16:15:45 +0000 (16:15 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 24 Jan 2003 16:15:45 +0000 (16:15 +0000)
Python/import.c

index 5df1f0a1d486d7d07e7bf7bd46a8fdfc33d8c3f4..b2cefc0a7ee41221be8bb8aa34e9da93ec73bbb7 100644 (file)
@@ -1214,23 +1214,26 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
                ** 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).
+               ** into them for resources). We only do this for string
+               ** items.
                */
-               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};
+               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;
+                               Py_XDECREF(copy);
+                               return &resfiledescr;
+                       }
                }
 #endif
                if (len > 0 && buf[len-1] != SEP