Message 391535 - Python tracker
Funny, I was looking into the same issue with CDLL(). :) The trick with ssl._ssl.__file__ may even break if users change sys.setdlopenflag() from RTLD_GLOBAL to RTLD_LOCAL. Static linking will also influence which symbols are available. Python/dynload_shlib.c keeps a list of dlopen handles around, but there is no way to access the list of handles. Mmh ... tricky.