@@ -416,7 +416,7 @@ def find_library(name):
416416# On platforms which provide dl_iterate_phdr(), dllist() is implemented
417417# in _ctypes.
418418try :
419- from _ctypes import dllist
419+ from _ctypes import dllist as dllist
420420except ImportError :
421421 pass
422422
@@ -525,55 +525,8 @@ def decorator(func):
525525
526526 return decorator
527527
528- ################################################################
529- # test code
530-
531528def test ():
532- from ctypes import cdll
533- if os .name == "nt" :
534- print (cdll .msvcrt )
535- print (cdll .load ("msvcrt" ))
536- print (find_library ("msvcrt" ))
537-
538- if os .name == "posix" :
539- # find and load_version
540- print (find_library ("m" ))
541- print (find_library ("c" ))
542- print (find_library ("bz2" ))
543-
544- # load
545- if sys .platform == "darwin" :
546- print (cdll .LoadLibrary ("libm.dylib" ))
547- print (cdll .LoadLibrary ("libcrypto.dylib" ))
548- print (cdll .LoadLibrary ("libSystem.dylib" ))
549- print (cdll .LoadLibrary ("System.framework/System" ))
550- # issue-26439 - fix broken test call for AIX
551- elif sys .platform .startswith ("aix" ):
552- from ctypes import CDLL
553- if sys .maxsize < 2 ** 32 :
554- print (f"Using CDLL(name, os.RTLD_MEMBER): { CDLL ('libc.a(shr.o)' , os .RTLD_MEMBER )} " )
555- print (f"Using cdll.LoadLibrary(): { cdll .LoadLibrary ('libc.a(shr.o)' )} " )
556- # librpm.so is only available as 32-bit shared library
557- print (find_library ("rpm" ))
558- print (cdll .LoadLibrary ("librpm.so" ))
559- else :
560- print (f"Using CDLL(name, os.RTLD_MEMBER): { CDLL ('libc.a(shr_64.o)' , os .RTLD_MEMBER )} " )
561- print (f"Using cdll.LoadLibrary(): { cdll .LoadLibrary ('libc.a(shr_64.o)' )} " )
562- print (f"crypt\t :: { find_library ('crypt' )} " )
563- print (f"crypt\t :: { cdll .LoadLibrary (find_library ('crypt' ))} " )
564- print (f"crypto\t :: { find_library ('crypto' )} " )
565- print (f"crypto\t :: { cdll .LoadLibrary (find_library ('crypto' ))} " )
566- else :
567- print (cdll .LoadLibrary ("libm.so" ))
568- print (cdll .LoadLibrary ("libcrypt.so" ))
569- print (find_library ("crypt" ))
570-
571- try :
572- dllist
573- except NameError :
574- print ('dllist() not available' )
575- else :
576- print (dllist ())
577-
578- if __name__ == "__main__" :
579- test ()
529+ """
530+ This function is a no-op and is soft-deprecated since Python 3.16.
531+ Do not use.
532+ """
0 commit comments