mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fixed potential refcount problems with interned strings, adapted comments, added a bit more trace output if verbose > 1.
This commit is contained in:
parent
66e794d743
commit
603e76e882
1 changed files with 16 additions and 6 deletions
|
@ -68,7 +68,7 @@ findnamedresource(
|
||||||
Handle h;
|
Handle h;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** If we have interning find_module takes care of interning all
|
** Find_module takes care of interning all
|
||||||
** sys.path components. We then keep a record of all sys.path
|
** sys.path components. We then keep a record of all sys.path
|
||||||
** components for which GetFInfo has failed (usually because the
|
** components for which GetFInfo has failed (usually because the
|
||||||
** component in question is a folder), and we don't try opening these
|
** component in question is a folder), and we don't try opening these
|
||||||
|
@ -85,9 +85,13 @@ findnamedresource(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) {
|
if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) {
|
||||||
if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned )
|
/* doesn't exist or is folder */
|
||||||
|
if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) {
|
||||||
|
Py_INCREF(obj);
|
||||||
not_a_file[max_not_a_file++] = obj;
|
not_a_file[max_not_a_file++] = obj;
|
||||||
/* doesn't exist or is folder */
|
if (Py_VerboseFlag > 1)
|
||||||
|
PySys_WriteStderr("# %s is not a file\n", filename);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) {
|
if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) {
|
||||||
|
@ -100,10 +104,14 @@ findnamedresource(
|
||||||
UseResFile(PyMac_AppRefNum);
|
UseResFile(PyMac_AppRefNum);
|
||||||
filerh = -1;
|
filerh = -1;
|
||||||
} else {
|
} else {
|
||||||
if ( FSpGetFInfo(&fss, &finfo) != noErr ) {
|
if ( FSpGetFInfo(&fss, &finfo) != noErr ) {
|
||||||
if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned )
|
/* doesn't exist or is folder */
|
||||||
|
if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) {
|
||||||
|
Py_INCREF(obj);
|
||||||
not_a_file[max_not_a_file++] = obj;
|
not_a_file[max_not_a_file++] = obj;
|
||||||
/* doesn't exist or is folder */
|
if (Py_VerboseFlag > 1)
|
||||||
|
PySys_WriteStderr("# %s is not a file\n", filename);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
oldrh = CurResFile();
|
oldrh = CurResFile();
|
||||||
|
@ -114,6 +122,8 @@ findnamedresource(
|
||||||
}
|
}
|
||||||
if ( dataptr == NULL )
|
if ( dataptr == NULL )
|
||||||
SetResLoad(0);
|
SetResLoad(0);
|
||||||
|
if (Py_VerboseFlag > 1)
|
||||||
|
PySys_WriteStderr("# Look for ('PYC ', %s) in %s\n", module, filename);
|
||||||
h = Get1NamedResource(restype, Pstring(module));
|
h = Get1NamedResource(restype, Pstring(module));
|
||||||
SetResLoad(1);
|
SetResLoad(1);
|
||||||
ok = (h != NULL);
|
ok = (h != NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue