This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aixtools@gmail.com
Recipients Michael.Felt, aixtools@gmail.com, martin.panter
Date 2016-08-23.14:48:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <57ce8937-08a5-55eb-ca85-a2812f676298@gmail.com>
In-reply-to <1471910464.71.0.676279123654.issue27435@psf.upfronthosting.co.za>
Content
On 23-Aug-16 02:01, Martin Panter wrote:
> Martin Panter added the comment:
Thank you for your reply!
>
> I had understood that changing find_library() would only be useful in combination with the automatic RTDL_MEMBER detection.
Adding the RTLD_MEMBER to the mode would be necessary for support of 
native archives. Without it, dlopen() will not work.
If I understand your comments correctly a python programmer could change 
all blocks such as: (please forgive syntax errors, if I make one, I may 
miss a : or the indent might not be straight)

Now:
xxxdl = cdll.LoadLibrary(find_library("xxx"))

Patched:
if sys.platform.startswith("aix"):
     dlname = find_library("xxx")
     if dlname and dlname.endswith(")") and dlname.rfind(".a(") > 0:
         from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
         mode = RTLD_LOCAL | 0x00040000
         xxxdl = cdll.LoadLibrary(dlname, mode)
     else if dlname:
         xxxld = cdll.LoadLibrary(dlname)
     else:
         xxxdl = cdll.LoadLibrary(find_library("xxx"))

> If you want to mention lack of support for AIX in the documentation, that is okay by me. If you want to propose an alternative find_library() implementation _without_ affecting the CDLL behaviour, that may be okay too.
I certainly do not want to document lack of support - I would prefer to 
see belated support for AIX. If the code above is all that is acceptable 
for 2.7 then I am still not as happy as I could be - I would rather not 
require all programmers that are still active in Python2 to add a new 
function to replace the default find_library() - as I think rewriting it 
as a private function is more secure than finding and changing every 
call to ctypes.find_library currently in "my" code.
And, of course, the other change would be everywhere where I now import 
ctypes.util would be to import my own function (that would be the only 
place I imports ctypes.
In short, what I hope for is that the "Now:" codeblock above will work asis.
>
> For the libuuid problem, for 2.7 I would suggest adding an explicit call to load libc.a(. . .) or whatever is appropriate.
Again, without also adding the constant 0x00040000 adding an explicit 
call to "libc.a(shr.o)" (32-bit mode) or "libc.a(shr_64.o)" is pointless.
And, if you would permit the constant 0x00040000 in Lib/uuid.py to make 
those calls work, then why not let it be in Lib/ctypes/__init__.py ?

>
> Personally I don’t have a specific interest in AIX, but I am happy to commit patches for AIX if I think they are sensible. I think I mentioned before in the other bug that your changes seemed okay for the next Python version.
If I recall, I submitted patches but not processed via Mercurial - not 
had the time to learn that.

I see (now) that you have processed them, and set them for review - many 
thanks.

I do not have any specific interest in python. My interest is supporting 
people who want to use python on AIX. And as PEP 373 says Python is 
supported into/until 2020 - it seems reasonable to correct an omission. 
A computer does not care whether the block is "Now:" or "Patched:". But 
I think most python developers would prefer not having to patch all 
their code. Rather, I fear they will say "we cannot/do not support AIX" 
because ... (some politically correct answer to not say AIX support is 
broken).

> The beta deadline for 3.6 is in a few weeks (PEP 494), although after that there is still 3.7.
Again, I submitted something. It probably needs changes. I'll check the 
review. What else is needed for that to be accepted?

If it misses 3.6, then I will have some soul searching to do.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27435>
> _______________________________________
History
Date User Action Args
2016-08-23 14:48:22aixtools@gmail.comsetrecipients: + aixtools@gmail.com, martin.panter, Michael.Felt
2016-08-23 14:48:22aixtools@gmail.comlinkissue27435 messages
2016-08-23 14:48:22aixtools@gmail.comcreate