Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macgetpath.c @ 4205:c7994008378d legacy-trunk
Check that our override pythonpath is actually coming from the
application, not from some system extension that happens to use the
same resource id.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Thu, 05 Sep 1996 15:19:24 +0000 |
| parents | a22438e94fe9 |
| children | 84444ea3f5f6 |
line wrap: on
line diff
--- a/Mac/Python/macgetpath.c Thu Sep 05 15:17:57 1996 +0000 +++ b/Mac/Python/macgetpath.c Thu Sep 05 15:19:24 1996 +0000 @@ -210,6 +210,21 @@ Str255 pathitem; int resource_id; OSErr err; + Handle h; + + /* + ** This is a bit tricky. We check here whether the current resource file + ** contains an override. This is to forestall us finding another STR# resource + ** with "our" id and using that for path initialization + */ + SetResLoad(0); + if ( (h=Get1Resource('STR#', PYTHONPATHOVERRIDE_ID)) ) { + ReleaseResource(h); + resource_id = PYTHONPATHOVERRIDE_ID; + } else { + resource_id = PYTHONPATH_ID; + } + SetResLoad(1); /* ** Remember old resource file and try to open preferences file @@ -229,14 +244,7 @@ if( (rv = malloc(2)) == NULL ) goto out; strcpy(rv, "\n"); - /* - ** See whether there's an override. - */ - GetIndString(pathitem, PYTHONPATHOVERRIDE_ID, 1); - if ( pathitem[0] ) - resource_id = PYTHONPATHOVERRIDE_ID; - else - resource_id = PYTHONPATH_ID; + for(i=1; ; i++) { GetIndString(pathitem, resource_id, i); if( pathitem[0] == 0 )
