Skip to content

Commit 009e6f2

Browse files
committed
Revert the check order
1 parent 8eed7be commit 009e6f2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Lib/ctypes/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,23 +444,23 @@ def _load_library(self, name, mode, handle, winmode):
444444

445445
else:
446446
def _load_library(self, name, mode, handle, winmode):
447-
if _sys.platform.startswith("aix"):
448-
"""When the name contains ".a(" and ends with ")",
449-
e.g., "libFOO.a(libFOO.so)" - this is taken to be an
450-
archive(member) syntax for dlopen(), and the mode is adjusted.
451-
Otherwise, name is presented to dlopen() as a file argument.
452-
"""
453-
if name and name.endswith(")") and ".a(" in name:
454-
mode |= _os.RTLD_MEMBER | _os.RTLD_NOW
455447
# If the filename that has been provided is an iOS/tvOS/watchOS
456448
# .fwork file, dereference the location to the true origin of the
457449
# binary.
458-
if name.endswith(".fwork"):
450+
if name and name.endswith(".fwork"):
459451
with open(name) as f:
460452
name = _os.path.join(
461453
_os.path.dirname(_sys.executable),
462454
f.read().strip()
463455
)
456+
if _sys.platform.startswith("aix"):
457+
"""When the name contains ".a(" and ends with ")",
458+
e.g., "libFOO.a(libFOO.so)" - this is taken to be an
459+
archive(member) syntax for dlopen(), and the mode is adjusted.
460+
Otherwise, name is presented to dlopen() as a file argument.
461+
"""
462+
if name and name.endswith(")") and ".a(" in name:
463+
mode |= _os.RTLD_MEMBER | _os.RTLD_NOW
464464
self._name = name
465465
return _dlopen(name, mode)
466466

0 commit comments

Comments
 (0)