diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-08-11 21:54:11 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-08-11 21:54:11 (GMT) |
commit | abce416e1678118da5fe1e667a1ad8a9c9c430c1 (patch) | |
tree | 1243f21ae6ba39362692dfbb4da1a4b638ba451b /Python | |
parent | 1abf610b154cc727f219fd52b2c1f868584a6e7b (diff) | |
download | cpython-abce416e1678118da5fe1e667a1ad8a9c9c430c1.zip cpython-abce416e1678118da5fe1e667a1ad8a9c9c430c1.tar.gz cpython-abce416e1678118da5fe1e667a1ad8a9c9c430c1.tar.bz2 |
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).
Diffstat (limited to 'Python')
-rw-r--r-- | Python/dynload_next.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/dynload_next.c b/Python/dynload_next.c index 9a5c828..2b34315 100644 --- a/Python/dynload_next.c +++ b/Python/dynload_next.c @@ -119,14 +119,18 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, NSObjectFileImage image; NSModule newModule; NSSymbol theSym; - void *symaddr; const char *errString; + if (NSIsSymbolNameDefined(funcname)) { + theSym = NSLookupAndBindSymbol(funcname); + p = (dl_funcptr)NSAddressOfSymbol(theSym); + return p; + } rc = NSCreateObjectFileImageFromFile(pathname, &image); switch(rc) { default: case NSObjectFileImageFailure: - NSObjectFileImageFormat: + case NSObjectFileImageFormat: /* for these a message is printed on stderr by dyld */ errString = "Can't create object file image"; break; @@ -139,7 +143,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, case NSObjectFileImageArch: errString = "Wrong CPU type in object file"; break; - NSObjectFileImageAccess: + case NSObjectFileImageAccess: errString = "Can't read object file (no access)"; break; } |