summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-01-24 16:15:45 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-01-24 16:15:45 (GMT)
commit9363dca3f818fa046bdef5d8dbd73f2cbde42fb0 (patch)
tree827263d6f8e009a8815314367d61fd5a02a0cb20 /Python
parent0064026668cd1dc5ffe005532e4ccc23e55c2b35 (diff)
downloadcpython-9363dca3f818fa046bdef5d8dbd73f2cbde42fb0.zip
cpython-9363dca3f818fa046bdef5d8dbd73f2cbde42fb0.tar.gz
cpython-9363dca3f818fa046bdef5d8dbd73f2cbde42fb0.tar.bz2
MacPython-OS9 specific fix: If there are non-string items on sys.path don't try to intern them. This has the theoretical problem that resource filenames on sys.path cannot be unicode objects, but in practice that shouldn't matter.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/Python/import.c b/Python/import.c
index 5df1f0a..b2cefc0 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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