diff options
| author | Jack Jansen <jack.jansen@cwi.nl> | 2003-02-25 14:20:44 (GMT) |
|---|---|---|
| committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-02-25 14:20:44 (GMT) |
| commit | 427ee3bbddbc8bd8b22868c24c96123728f15889 (patch) | |
| tree | f2a7118bfcc4c87541a1f4550fd220c198b97723 /Python | |
| parent | 11450a4de4df7623c0a9f512f34e1c5ff72cc3d1 (diff) | |
| download | cpython-427ee3bbddbc8bd8b22868c24c96123728f15889.zip cpython-427ee3bbddbc8bd8b22868c24c96123728f15889.tar.gz cpython-427ee3bbddbc8bd8b22868c24c96123728f15889.tar.bz2 | |
Partial backport of 2.11: better error messages on import failures.
Fixes #652590.
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/dynload_next.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/dynload_next.c b/Python/dynload_next.c index 892bb47..6789bfe 100644 --- a/Python/dynload_next.c +++ b/Python/dynload_next.c @@ -120,6 +120,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, NSModule newModule; NSSymbol theSym; const char *errString; + char errBuf[512]; if (NSIsSymbolNameDefined(funcname)) { theSym = NSLookupAndBindSymbol(funcname); @@ -150,8 +151,15 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, if (errString == NULL) { newModule = NSLinkModule(image, pathname, NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_RETURN_ON_ERROR); - if (!newModule) - errString = "Failure linking new module"; + if (newModule == NULL) { + int errNo; + char *fileName, *moreErrorStr; + NSLinkEditErrors c; + NSLinkEditError( &c, &errNo, &fileName, &moreErrorStr ); + PyOS_snprintf(errBuf, 512, "Failure linking new module: %s: %s", + fileName, moreErrorStr); + errString = errBuf; + } } if (errString != NULL) { PyErr_SetString(PyExc_ImportError, errString); |
