[New-bugs-announce] [issue20276] ctypes._dlopen should not force RTLD_NOW

Albert Zeyer report at bugs.python.org
Thu Jan 16 02:20:50 CET 2014


New submission from Albert Zeyer:

On MacOSX, when you build an ARC-enabled Dylib with backward compatibility for e.g. MacOSX 10.6, some unresolved functions like `_objc_retainAutoreleaseReturnValue` might end up in your Dylib.

Some reference about the issue:
1. http://stackoverflow.com/q/21119425/133374>.
2. http://osdir.com/ml/python.ctypes/2006-10/msg00029.html
3. https://groups.google.com/forum/#!topic/comp.lang.python/DKmNGwyLl3w

Thus, RTLD_NOW is often not an option for MacOSX.

This affects mostly `py_dl_open()` from ctypes.
But it is also related how you set `dlopenflags` in `PyInterpreterState_New()`.

I suggest to make RTLD_LAZY the default on MacOSX (or is there a good reason not to do?).
Also, ctypes should have options for both RTLD_NOW and RTLD_LAZY so that both can be used.

This is also consistent with the behavior of the [dl module](http://docs.python.org/2/library/dl.html).

----------
components: ctypes
messages: 208226
nosy: Albert.Zeyer
priority: normal
severity: normal
status: open
title: ctypes._dlopen should not force RTLD_NOW
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20276>
_______________________________________


More information about the New-bugs-announce mailing list