This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, shuoz, terry.reedy
Date 2018-10-06.02:55:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538794541.02.0.545547206417.issue34840@psf.upfronthosting.co.za>
In-reply-to
Content
> FWIW, the method does not exist on Windows

In Windows it's FreeLibrary, for which the implementation in NT calls loader and runtime library functions such as LdrUnloadDll and RtlImageNtHeaderEx. These OS functions internally use structured exception handling (SEH) to retun status codes such as STATUS_DLL_NOT_FOUND and STATUS_INVALID_IMAGE_FORMAT instead of crashing the process when passed an invalid module handle (i.e. module base address).

For POSIX, I don't see what can be done to avoid a crash when dlclose is passed a bad handle (i.e. module address). We can check for NULL, the obvious case, but otherwise AFAIK we can only detect an invalid address by trying to access it, which triggers a segfault. This is the reason that dlclose is only available in the private _ctypes module, and ctypes itself never even calls it.
History
Date User Action Args
2018-10-06 02:55:41eryksunsetrecipients: + eryksun, terry.reedy, shuoz
2018-10-06 02:55:41eryksunsetmessageid: <1538794541.02.0.545547206417.issue34840@psf.upfronthosting.co.za>
2018-10-06 02:55:40eryksunlinkissue34840 messages
2018-10-06 02:55:40eryksuncreate