Skip to content

Commit 07579ea

Browse files
authored
Bugfix to allow importing numpy again. (#21197)
1 parent 66316fd commit 07579ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/Python/PythonLibrary.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ private extension PythonLibrary {
191191

192192
static func loadPythonLibrary(at path: String) -> UnsafeMutableRawPointer? {
193193
log("Trying to load library at '\(path)'...")
194-
let pythonLibraryHandle = dlopen(path, RTLD_LAZY)
194+
// Must be RTLD_GLOBAL because subsequent .so files from the imported python
195+
// modules may depend on this .so file.
196+
let pythonLibraryHandle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL)
195197

196198
if pythonLibraryHandle != nil {
197199
log("Library at '\(path)' was sucessfully loaded.")

0 commit comments

Comments
 (0)