Opened 10 years ago

Closed 3 years ago

#140 closed task (fixed)

python: Implement ctypes module

Reported by: dmik Owned by:
Priority: major Milestone:
Component: python Version:
Severity: medium Keywords:
Cc:

Description

It seems that the ctypes module that allows calling functions in native DLLs right from python doesn't support OS/2 at the moment. There is Win32 support though so adding OS/2 should be easy.

One should start from looking at source:/python/trunk/Modules/_ctypes/callproc.c and source:/python/trunk/Lib/ctypes/.

Change History (5)

comment:1 by dmik, 10 years ago

This functionality is for example used by the coolorama module which is part of the pip python library version 1.5.4 used by Mozilla esr31.

comment:2 by dmik, 10 years ago

Note that I currently use the following hack to /usr/lib/python2.7/ctypes/__init__.py to silently fail instead of throw an exception:

--- __init__.py.b   2015-02-26 21:23:20.000000000 +0400
+++ __init__.py 2015-04-23 21:55:04.000000000 +0400
@@ -140,6 +140,10 @@
 elif _os.name == "posix":
     from _ctypes import dlopen as _dlopen

+elif _os.name == "os2":
+    def _dlopen(name, mode):
+        return
+
 from _ctypes import sizeof, byref, addressof, alignment, resize
 from _ctypes import get_errno, set_errno
 from _ctypes import _SimpleCData

I don't think it's OK to distribute this hack widely by including it into the package — it's too loose and there is a big probability to create unexpected behavior in many cases.

comment:3 by dmik, 9 years ago

Type: taskdefect

JFYI, more details about the failure that raised this ticket are here: https://github.com/bitwiseworks/mozilla-os2/issues/100#issuecomment-95366689. In the meantime, I committed the above hack in r602.

comment:4 by dmik, 9 years ago

Type: defecttask

comment:5 by Silvan Scherrer, 3 years ago

Resolution: fixed
Status: newclosed

this is fixed in python3.9. and we don't plan to update old python anymore

Note: See TracTickets for help on using tickets.