Skip to content

Commit 5ab1b02

Browse files
committed
Update to work on musl systems
1 parent 3918675 commit 5ab1b02

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

‎Doc/library/ctypes.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ Utility functions
21062106
The first element of the list is typically the path of the current executable
21072107
file. The exact functionality is system dependent.
21082108

2109-
.. availability:: Windows, macOS, glibc, BSD libc
2109+
.. availability:: Windows, macOS, glibc, BSD libc, musl
21102110
.. versionadded:: 3.14
21112111

21122112
.. function:: FormatError([code])

‎Lib/ctypes/util.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,10 @@ def find_library(name):
419419
# https://man.freebsd.org/cgi/man.cgi?query=dl_iterate_phdr
420420
# https://man.openbsd.org/dl_iterate_phdr
421421
# https://docs.oracle.com/cd/E88353_01/html/E37843/dl-iterate-phdr-3c.html
422-
# this relies on find_library, which is why it is defined at the end
423422
if (os.name == "posix" and
424423
sys.platform not in {"darwin", "ios", "tvos", "watchos"}):
425424
import ctypes
426-
_libc_path = find_library("c")
427-
if (_libc_path is not None and
428-
hasattr((_libc := ctypes.CDLL(_libc_path)), "dl_iterate_phdr")):
425+
if hasattr((_libc := ctypes.CDLL(None)), "dl_iterate_phdr"):
429426

430427
class _dl_phdr_info(ctypes.Structure):
431428
_fields_ = [

0 commit comments

Comments
 (0)