Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dl broken on non-ILP32 platforms #46417

Closed
notting mannequin opened this issue Feb 22, 2008 · 7 comments
Closed

dl broken on non-ILP32 platforms #46417

notting mannequin opened this issue Feb 22, 2008 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@notting
Copy link
Mannequin

notting mannequin commented Feb 22, 2008

BPO 2164
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-02-22.20:54:30.437>
created_at = <Date 2008-02-22.20:27:45.069>
labels = ['type-bug', 'library']
title = 'dl broken on non-ILP32 platforms'
updated_at = <Date 2008-02-22.21:25:33.355>
user = 'https://bugs.python.org/notting'

bugs.python.org fields:

activity = <Date 2008-02-22.21:25:33.355>
actor = 'loewis'
assignee = 'none'
closed = True
closed_date = <Date 2008-02-22.20:54:30.437>
closer = 'loewis'
components = ['Library (Lib)']
creation = <Date 2008-02-22.20:27:45.069>
creator = 'notting'
dependencies = []
files = []
hgrepos = []
issue_num = 2164
keywords = []
message_count = 7.0
messages = ['62695', '62696', '62700', '62701', '62702', '62703', '62705']
nosy_count = 2.0
nosy_names = ['loewis', 'notting']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2164'
versions = ['Python 2.5']

@notting
Copy link
Mannequin Author

notting mannequin commented Feb 22, 2008

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.

@notting notting mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 22, 2008
@notting
Copy link
Mannequin Author

notting mannequin commented Feb 22, 2008

Moreover, eliding the check and subsequent error from the code yields a
module that appears to work in (very) brief testing on x86_64.

@loewis
Copy link
Mannequin

loewis mannequin commented Feb 22, 2008

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)

@loewis loewis mannequin closed this as completed Feb 22, 2008
@notting
Copy link
Mannequin Author

notting mannequin commented Feb 22, 2008

sizeof(long) != sizeof(void *) isn't the epic fail here. It's the
complaint about sizeof(int) != sizeof(long).

@loewis
Copy link
Mannequin

loewis mannequin commented Feb 22, 2008

sizeof(long) != sizeof(void *) isn't the epic fail here. It's the
complaint about sizeof(int) != sizeof(long).

Same story.

@notting
Copy link
Mannequin Author

notting mannequin commented Feb 22, 2008

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.)

@loewis
Copy link
Mannequin

loewis mannequin commented Feb 22, 2008

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants