/
alpine-py38-ctypes.patch
34 lines (30 loc) · 1.5 KB
/
alpine-py38-ctypes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/lib/python/ctypes/ctypesgencore/ctypedescs.py b/lib/python/ctypes/ctypesgencore/ctypedescs.py
index 1b061ea1f..b04fba80e 100644
--- a/lib/python/ctypes/ctypesgencore/ctypedescs.py
+++ b/lib/python/ctypes/ctypesgencore/ctypedescs.py
@@ -297,8 +297,16 @@ class CtypesFunction(CtypesType):
CtypesType.visit(self, visitor)
def py_string(self):
+ at = []
+ for a in self.argtypes:
+ if a.py_string() == "String":
+ at.append("POINTER(String)")
+ elif a.py_string()[:5] == "union":
+ at.append("POINTER(%s)" % a.py_string())
+ else:
+ at.append(a.py_string())
return 'CFUNCTYPE(UNCHECKED(%s), %s)' % (self.restype.py_string(),
- ', '.join([a.py_string() for a in self.argtypes]))
+ ', '.join([a for a in at]))
last_tagnum = 0
diff --git a/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py b/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py
index b64d38c9c..0a840acff 100644
--- a/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py
+++ b/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py
@@ -183,7 +183,7 @@ class CtypesParser(CParser):
isinstance(t.destination, CtypesSimple) and
t.destination.name == "char" and
t.destination.signed):
- t = CtypesSpecial("String")
+ t = CtypesSpecial("POINTER(String)")
return t