Mercurial > cpython-lru_cache-weakref
diff Python/dynload_next.c @ 21031:9746219813f9 2.1
backport of 2.8 by jack:
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).
| author | Anthony Baxter <anthonybaxter@gmail.com> |
|---|---|
| date | Wed, 21 Nov 2001 04:58:37 +0000 |
| parents | 6f6f965c5e2d |
| children | 379fc66f4c96 |
line wrap: on
line diff
--- a/Python/dynload_next.c Wed Nov 21 04:49:19 2001 +0000 +++ b/Python/dynload_next.c Wed Nov 21 04:58:37 2001 +0000 @@ -119,14 +119,18 @@ 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 @@ case NSObjectFileImageArch: errString = "Wrong CPU type in object file"; break; - NSObjectFileImageAccess: + case NSObjectFileImageAccess: errString = "Can't read object file (no access)"; break; }
