classification
Title: dl broken on non-ILP32 platforms
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, notting
Priority: normal Keywords:

Created on 2008-02-22 20:27 by notting, last changed 2008-02-22 21:25 by loewis. This issue is now closed.

Messages (7)
msg62695 - (view) Author: Bill Nottingham (notting) Date: 2008-02-22 20:27
SystemError: module dl requires sizeof(int) == sizeof(long) == sizeof(char*)

That's just unspeakably lame. I realize this is longstanding, and it's
even documented, but just... FAIL.
msg62696 - (view) Author: Bill Nottingham (notting) Date: 2008-02-22 20:31
Moreover, eliding the check and subsequent error from the code yields a
module that appears to work in (very) brief testing on x86_64.
msg62700 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-02-22 20:54
The limitation is genuine; it's not possible to implement dl_call
correctly if sizeof(long) != sizeof(void*), say. Otherwise, it would
have been fixed long ago. Use ctypes instead, if that is supported for
your hardware. (More generally, it's not possible to implement this at
all in portable C, that's why ctypes uses assembler code. That dl works
on most "pure" 32-bit systems is by sheer luck)
msg62701 - (view) Author: Bill Nottingham (notting) Date: 2008-02-22 21:04
sizeof(long) != sizeof(void *) isn't the epic fail here. It's the
complaint about sizeof(int) != sizeof(long).
msg62702 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-02-22 21:09
> sizeof(long) != sizeof(void *) isn't the epic fail here. It's the
> complaint about sizeof(int) != sizeof(long).

Same story.
msg62703 - (view) Author: Bill Nottingham (notting) Date: 2008-02-22 21:17
If it's not possible to implement at all, why does it work without the
test?  What specific cases do you think will fail?

Heck, if you don't think it's functional on 90% of hardware sold these
days, just remove it, it makes python look less silly. (Portability is
hard, let's punt.)
msg62705 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-02-22 21:25
It fails if the function being called has parameters which are not
sizeof(long), and the platform has a calling convention where such
parameters are passed on the stack, and consume a size different from
sizeof(long) on the stack.

I disagree that it won't run on 90% of the hardware sold today - you
just have to operate that hardware properly to make it work. In any
case, removal of the dl module in favor of ctypes seems reasonable.
History
Date User Action Args
2008-02-22 21:25:33loewissetmessages: + msg62705
2008-02-22 21:17:35nottingsetmessages: + msg62703
2008-02-22 21:09:38loewissetmessages: + msg62702
2008-02-22 21:04:17nottingsetmessages: + msg62701
2008-02-22 20:54:30loewissetstatus: open -> closed
resolution: wont fix
messages: + msg62700
nosy: + loewis
2008-02-22 20:31:57nottingsetmessages: + msg62696
2008-02-22 20:27:45nottingcreate