Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e497978

Browse files
committed
Fix for 838140: don't call NSUnlinkModule when we fail to find our
expected entrypoint. The unlinking will crash the application if the module contained ObjC code. The price of this is small: a little wasted memory, and only in a case than isn't expected to occur often.
1 parent ad1654e commit e497978

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Python/dynload_next.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
9292
#ifdef USE_DYLD_GLOBAL_NAMESPACE
9393
if (!NSIsSymbolNameDefined(funcname)) {
9494
/* UnlinkModule() isn't implemented in current versions, but calling it does no harm */
95-
NSUnLinkModule(newModule, FALSE);
95+
/* NSUnLinkModule(newModule, FALSE); removed: causes problems for ObjC code */
9696
PyErr_Format(PyExc_ImportError,
9797
"Loaded module does not contain symbol %.200s",
9898
funcname);
@@ -102,7 +102,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
102102
#else
103103
theSym = NSLookupSymbolInModule(newModule, funcname);
104104
if ( theSym == NULL ) {
105-
NSUnLinkModule(newModule, FALSE);
105+
/* NSUnLinkModule(newModule, FALSE); removed: causes problems for ObjC code */
106106
PyErr_Format(PyExc_ImportError,
107107
"Loaded module does not contain symbol %.200s",
108108
funcname);

0 commit comments

Comments
 (0)