[issue38628] Issue with ctypes in AIX

2020-08-16 Thread Vinay Sajip
Vinay Sajip added the comment: > Implementing a work-around solely based on x64 ABI is not correct. But AFAIK the test_array_in_struct test passes on AIX and exercises the workaround - why does it work if the workaround is faulty? If OTOH the test is faulty, could you update it with code

[issue38628] Issue with ctypes in AIX

2020-08-16 Thread David Edelsohn
David Edelsohn added the comment: Yes, it doesn't appear that it will be solved in libffi. I don't fully understand the need for the work-around because it should gracefully overflow to the stack. I can't tell if the issue is a problem with arguments passed by value that need to be passed

[issue38628] Issue with ctypes in AIX

2020-08-16 Thread Vinay Sajip
Vinay Sajip added the comment: > an array definition in a structure is always part of the struct itself and is > never a pointer True, but a problem only arises in practice when passing by value in registers. It's still an open libffi issue that doesn't look like it's going to be solved

[issue38628] Issue with ctypes in AIX

2020-08-16 Thread Ronald Oussoren
Ronald Oussoren added the comment: As mentioned before I haven't studied the ctypes code base, but I am a bit worried about the use of MAX_STRUCT_SIZE, an array definition in a structure is always part of the struct itself and is never a pointer. I agree with Vinay that there needs to be a

[issue38628] Issue with ctypes in AIX

2020-08-15 Thread Vinay Sajip
Vinay Sajip added the comment: > stgdict.c currently includes a target-specific work-around for small > structures that is not restricted to the one target (x64) affected. What's > the best way to proceed? I think more data is needed to determine the best way to proceed. The original

[issue38628] Issue with ctypes in AIX

2020-08-10 Thread David Edelsohn
David Edelsohn added the comment: +Eryksun,Vinay The patch to address array passing described in issue #22273 introduced regressions for other targets. The 16 byte struct size is specific to x86 ABI and register passing convention. I appreciate that the 16-32 byte size structure causes

[issue38628] Issue with ctypes in AIX

2020-08-05 Thread Ronald Oussoren
Ronald Oussoren added the comment: Relevant libffi documentation: https://github.com/libffi/libffi/blob/4661ba7928b49588aec9e6976673208c8cbf0295/doc/libffi.texi#L505 -- ___ Python tracker

[issue38628] Issue with ctypes in AIX

2020-08-05 Thread Ronald Oussoren
Ronald Oussoren added the comment: As I mentioned earlier the code in sgtdict.c seems dodgy, the libffi representation for an array in a dict should be the same regardless of the size of the dictionary. That said, I haven't studied the ctypes code yet and am not sure if my analysis is

[issue38628] Issue with ctypes in AIX

2020-08-04 Thread David Edelsohn
David Edelsohn added the comment: As mentioned in the stgdict.c comment, this relates back to #22273 and #29565. The passing of arrays/structs is fragile, to use a euphemism. The ctypes behavior conforms to the x64 Linux ABI and x64 libffi, even the comment from #22273, "Structs that are

[issue38628] Issue with ctypes in AIX

2020-08-04 Thread Tony Reix
Tony Reix added the comment: I do agree that the example with memchr is not correct. About your suggestion, I've done it. With 32. And that works fine. All 3 values are passed by value. # cat Pb-3.8.5.py #!/usr/bin/env python3 from ctypes import * mine = CDLL('./MemchrArgsHack2.so')

[issue38628] Issue with ctypes in AIX

2020-08-04 Thread Sanket Rathi
Change by Sanket Rathi : -- nosy: +sanket ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38628] Issue with ctypes in AIX

2020-08-03 Thread David Edelsohn
David Edelsohn added the comment: The example with memchr() never will be correct because it is invalid to call a function with an argument list that doesn't match the function signature. Your comment mentions that the AIX structure is size 16, but it looks like Python calculates the AIX

[issue38628] Issue with ctypes in AIX

2020-08-03 Thread Tony Reix
Tony Reix added the comment: After more investigations, we (Damien and I) think that there are several issues in Python 3.8.5 : 1) Documentation. a) AFAIK, the only place in the Python ctypes documentation where it talks about how arrays in a structure are managed appears at:

[issue38628] Issue with ctypes in AIX

2020-08-03 Thread Ronald Oussoren
Change by Ronald Oussoren : -- nosy: +amaury.forgeotdarc, belopolsky, meador.inge ___ Python tracker ___ ___ Python-bugs-list

[issue38628] Issue with ctypes in AIX

2020-08-03 Thread Ronald Oussoren
Ronald Oussoren added the comment: Thanks for the code reference. I'm not a ctypes expert, but do maintain another project using libffi. The comment in stgdict.c is correct, and that code is used for all platforms. However, code to embed arrays into a struct (as described int the comment)

[issue38628] Issue with ctypes in AIX

2020-08-02 Thread David Edelsohn
David Edelsohn added the comment: I thought that the ctypes documentation mentioned that Arrays passed by Value are converted to Structures. I cannot find it in the ctypes documentation at the moment. But Modules/_ctypes/stgdict.c has a large comment about passing Arrays by Value as

[issue38628] Issue with ctypes in AIX

2020-08-02 Thread Ronald Oussoren
Ronald Oussoren added the comment: David, is the issue you mention in your message at 2020-02-05 reproducible with valid usage of ctypes (that is, by calling a C function with the correct signature)? What do you mean with "this is documented in Python ctypes"? -- nosy:

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread David Edelsohn
David Edelsohn added the comment: Tony, Please see my reply from 2020-02-05. This is a known "bug" in Python ctypes. This is documented in Python ctypes. This will not be fixed. This cannot be fixed. Python ctypes converts the array to a structure and creates an incorrect libffi

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread Tony Reix
Tony Reix added the comment: Fedora32/x86_64 : Python v3.8.5 : optimized : uint type. If, instead of using ulong type, the Pb.py program makes use of uint, the issue is different: see below. This means that the issue depends on the length of the data. BUILD=optimized TYPE=int export

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread Tony Reix
Change by Tony Reix : -- versions: +Python 3.8 -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread Tony Reix
Tony Reix added the comment: Fedora32/x86_64 : Python v3.8.5 has been built. Issue is still there, but different in debug or optimized mode. Thus, change done in https://bugs.python.org/issue22273 did not fix this issue. ./Pb-3.8.5-debug.py :

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread Tony Reix
Tony Reix added the comment: After adding traces and after rebuilding Python and libffi with -O0 -g -gdwarf, it appears that, still in 64bit, the bug is still there, but that ffi_call_AIX is called now instead of ffi_call_DARWIN from ffi_call() routine of ../src/powerpc/ffi_darwin.c (lines

[issue38628] Issue with ctypes in AIX

2020-07-27 Thread Tony Reix
Tony Reix added the comment: On AIX 7.2, with libffi compiled with -O0 -g, I have: 1) Call to memchr thru memchr_args_hack #0 0x091b0d60 in memchr () from /usr/lib/libc.a(shr_64.o) #1 0x0900058487a0 in ffi_call_DARWIN () from /opt/freeware/lib/libffi.a(libffi.so.6) #2

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- nosy: +BTaskaya ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: # pwd /opt/freeware/src/packages/BUILD/libffi-3.2.1 # grep -R ffi_closure_ASM * powerpc-ibm-aix7.2.0.0/.libs/libffi.exp: ffi_closure_ASM powerpc-ibm-aix7.2.0.0/include/ffitarget.h:void * code_pointer; /* Pointer to ffi_closure_ASM */

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: AIX: difference between 32bit and 64bit. After the second print, the stack is: 32bit: #0 0xd01407e0 in memchr () from /usr/lib/libc.a(shr.o) #1 0xd438f480 in ffi_call_AIX () from /opt/freeware/lib/libffi.a(libffi.so.6) #2 0xd438effc in ffi_call () from

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: On AIX in 32bit, we have: Thread 2 hit Breakpoint 2, 0xd01407e0 in memchr () from /usr/lib/libc.a(shr.o) (gdb) where #0 0xd01407e0 in memchr () from /usr/lib/libc.a(shr.o) #1 0xd438f480 in ffi_call_AIX () from /opt/freeware/lib/libffi.a(libffi.so.6) #2

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: On Fedora/PPC64LE, where it is OK, the same debug with gdb gives: (gdb) where #0 0x77df03b0 in __memchr_power8 () from /lib64/libc.so.6 #1 0x7fffea167680 in ?? () from /lib64/libffi.so.6 #2 0x7fffea166284 in ffi_call () from /lib64/libffi.so.6

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: On Fedora/x86_64, in order to get the core, one must do: coredumpctl -o /tmp/core dump /usr/bin/python3.8 -- ___ Python tracker ___

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: On AIX: root@castor4## gdb /opt/freeware/bin/python3 ... (gdb) run -m pdb Pb.py ... (Pdb) n b'def' > /home2/freeware/src/packages/BUILD/Python-3.8.5/32bit/Pb.py(35)() -> print( (Pdb) n > /home2/freeware/src/packages/BUILD/Python-3.8.5/32bit/Pb.py(36)() ->

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: Fedora32/x86_64 [root@destiny10 tmp]# gdb /usr/bin/python3.8 core ... Core was generated by `python3 ./Pb.py'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x7f898a02a1d8 in __memchr_sse2 () from /lib64/libc.so.6 Missing separate debuginfos,

[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Tony Reix
Tony Reix added the comment: On Fedora32/PPC64LE (5.7.9-200.fc32.ppc64le), with little change: libc = CDLL('/usr/lib64/libc.so.6') I get the correct answer: b'def' b'def' b'def' # python3 --version Python 3.8.3 libffi : 3.1-24 On Fedora32/x86_64 (5.7.9-200.fc32.x86_64), with a little

[issue38628] Issue with ctypes in AIX

2020-02-05 Thread David Edelsohn
David Edelsohn added the comment: The bug report implies a different bug than what is being reported. The bug is not related to calling a LIBC function with an argument list that does not match the function signature. The true issue is that a Python ctypes structure definition on AIX that

[issue38628] Issue with ctypes in AIX

2020-02-04 Thread David Edelsohn
David Edelsohn added the comment: Is this a legal use of Python ctypes? I don't see anything in the Python documentation that one can call a ctypes function with an argument list that does not match the function signature and expect it to work. Maybe this works on x86 by accident, but

[issue38628] Issue with ctypes in AIX

2020-02-03 Thread David Edelsohn
David Edelsohn added the comment: How was Python compiled? With GCC? Which version of GCC? I assume that Python was built as a 64 bit application based on libc loading the 64 bit member shr_64.o. Does the testcase work in 32 bit mode? Does the testcase work if Python is compiled by XLC?

[issue38628] Issue with ctypes in AIX

2020-01-29 Thread David Edelsohn
Change by David Edelsohn : -- nosy: +David.Edelsohn, Michael.Felt ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue38628] Issue with ctypes in AIX

2019-11-14 Thread Ayappan
Ayappan added the comment: Any update on this ? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38628] Issue with ctypes in AIX

2019-10-29 Thread Ayappan
New submission from Ayappan : There seems to be a behavioral issue with ctypes in AIX. The specific symptom is that passing structures containing arrays to a C function by value appears to be broken. Consider the below program., #!/usr/bin/env python3 from ctypes import * libc = CDLL

[issue27435] ctypes and AIX - also for 2.7.X (and later)

2016-07-31 Thread Michael Felt
Michael Felt added the comment: > FYI: I tried to pip install Mercurial - but got an error message from an > include file so the last bit did not compile. Problem for a later date - > could be a user error on my part, or an AIX version dependency. (during > discussion issue26439) I have

[issue27435] ctypes and AIX - also for 2.7.X (and later)

2016-07-29 Thread Michael Felt
Michael Felt added the comment: """ Lib/ctype support for LoadLibrary interface to dlopen() for AIX Similar kind of support (i.e., as a separate file) as has been done for Darwin support ctype.macholib.* rather than as been done with for "ce", "nt", "solaris", and "bsd" with separate, detailed

[issue27435] ctypes and AIX - also for 2.7.X (and later)

2016-07-28 Thread Michael Felt
Michael Felt added the comment: Adding "type behavior" as I have now read that that is actually the python friendly way of talking about a 'bug'. Testing my proposed patch for 2.7 with python2.7.12 - will update with patch when finished. -- nosy: +Michael.Felt type: -> behavior

[issue27435] ctypes and AIX - also for 2.7.X (and later)

2016-07-01 Thread aixtools
e): if os.name == "ce" return None +79 def find_library(name): if sys.platform.startswith("aix") return ctypes._aixutils.find_library(name) +84 def find_library(name): elif os.name == "posix" and sys.platform == "darwin": +95 elif os.name ==

Re: ctypes for AIX

2015-07-28 Thread daixtr
I'm facing the same issue. No 'ctypes' in python 2.6/2.7 that i'm able to succesfully install via an AIX ppc rpm package. what's the story here? On Friday, 22 April 2011 22:30:07 UTC+8, Anssi Saari wrote: Waddle, Jim jim.wad...@boeing.com writes: I do not have sufficient knowledge to

Re: ctypes for AIX

2011-04-22 Thread sjw
I need to!But ctypes can't work on AIX... Need help.. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes for AIX

2011-04-22 Thread Stefan Behnel
sjw, 22.04.2011 15:26: I need to!But ctypes can't work on AIX... Need help.. What are you trying to do, and why do you need ctypes for it? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes for AIX

2011-04-22 Thread Anssi Saari
Waddle, Jim jim.wad...@boeing.com writes: I do not have sufficient knowledge to know how to fix this. I would think that this error somehow is related to compiling on aix. If you have any suggestions on how to correct this problem , I would appreciate it I'd have to guess your main problem

Re: ctypes for AIX

2010-01-27 Thread Antoine Pitrou
Hello, I then figured I would get a new copy of python and install it on AIX. I downloaded python.2.5.5c2 from http://www.python.org. I did the configure and make which posted many errors in the ctypes function which I guess is the reason that is does not get include in the final make. I

Re: ctypes for AIX

2010-01-26 Thread nn
-Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Sunday, January 24, 2010 7:31 AM To: Waddle, Jim Cc: python-l...@python.org Subject: Re: ctypes for AIX On Sun, Jan 24, 2010 at 5:54 AM, Waddle, Jim jim.wad...@boeing.com wrote: I need

Re: ctypes for AIX

2010-01-26 Thread M.-A. Lemburg
Waddle, Jim wrote: I need to use ctypes with python running on AIX. It appears that python is being developed mostly for windows. Is there a policy concerning getting functions like ctypes working on AIX. If you can provide patches to get ctypes working on AIX, we'd consider adding those

RE: ctypes for AIX

2010-01-25 Thread Waddle, Jim
: Sunday, January 24, 2010 7:31 AM To: Waddle, Jim Cc: python-list@python.org Subject: Re: ctypes for AIX On Sun, Jan 24, 2010 at 5:54 AM, Waddle, Jim jim.wad...@boeing.com wrote: I need to use ctypes with python running on AIX. According to the ctypes readme, ctypes is based on libffi, which according

ctypes for AIX

2010-01-24 Thread Waddle, Jim
I need to use ctypes with python running on AIX. It appears that python is being developed mostly for windows. Is there a policy concerning getting functions like ctypes working on AIX. Jim Waddle KIT-D 425-785-5194 -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes for AIX

2010-01-24 Thread Chris Rebert
considering one of Python's primary areas of use is for web applications as part of a LAMP stack. Is there a policy concerning getting functions like ctypes working on AIX. No idea. Someone will probably chime in though. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman

Re: ctypes for AIX

2010-01-24 Thread Andrew MacIntyre
Waddle, Jim wrote: Is there a policy concerning getting functions like ctypes working on AIX. If you can get it working, post a patch on the bug tracker. -- - Andrew I MacIntyre These thoughts are mine