mirror of
https://github.com/python/cpython.git
synced 2025-09-24 17:33:29 +00:00
Patch by Jonathan Wight (slightly reformatted) to forestall loading the
same module twice, which apparently crashes Python. I could not test the error condition, but in normal life it seems to have no adverse effects. Also removed an unsued variable, and corrected 2 glaring errors (missing 'case' in front of a label).
This commit is contained in:
parent
1abf610b15
commit
abce416e16
1 changed files with 7 additions and 3 deletions
|
@ -119,14 +119,18 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
||||||
NSObjectFileImage image;
|
NSObjectFileImage image;
|
||||||
NSModule newModule;
|
NSModule newModule;
|
||||||
NSSymbol theSym;
|
NSSymbol theSym;
|
||||||
void *symaddr;
|
|
||||||
const char *errString;
|
const char *errString;
|
||||||
|
|
||||||
|
if (NSIsSymbolNameDefined(funcname)) {
|
||||||
|
theSym = NSLookupAndBindSymbol(funcname);
|
||||||
|
p = (dl_funcptr)NSAddressOfSymbol(theSym);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
rc = NSCreateObjectFileImageFromFile(pathname, &image);
|
rc = NSCreateObjectFileImageFromFile(pathname, &image);
|
||||||
switch(rc) {
|
switch(rc) {
|
||||||
default:
|
default:
|
||||||
case NSObjectFileImageFailure:
|
case NSObjectFileImageFailure:
|
||||||
NSObjectFileImageFormat:
|
case NSObjectFileImageFormat:
|
||||||
/* for these a message is printed on stderr by dyld */
|
/* for these a message is printed on stderr by dyld */
|
||||||
errString = "Can't create object file image";
|
errString = "Can't create object file image";
|
||||||
break;
|
break;
|
||||||
|
@ -139,7 +143,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
||||||
case NSObjectFileImageArch:
|
case NSObjectFileImageArch:
|
||||||
errString = "Wrong CPU type in object file";
|
errString = "Wrong CPU type in object file";
|
||||||
break;
|
break;
|
||||||
NSObjectFileImageAccess:
|
case NSObjectFileImageAccess:
|
||||||
errString = "Can't read object file (no access)";
|
errString = "Can't read object file (no access)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue