8000 Merge branch 'feature/enable-ctypes' of github.com:olymk2/python-for-… · kivy/python-for-android@82e8921 · GitHub
[go: up one dir, main page]

Skip to content

Commit 82e8921

Browse files
author
Oliver Marks
committed
Merge branch 'feature/enable-ctypes' of github.com:olymk2/python-for-android into feature/enable-ctypes
2 parents a9e88fe + e8c0a4e commit 82e8921

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
diff -uNr Python-2.7.2.orig/Lib/ctypes/__init__.py Python-2.7.2/Lib/ctypes/__init__.py
2+
--- Python-2.7.2.orig/Lib/ctypes/__init__.py 2011-06-11 17:46:24.000000000 +0200
3+
+++ Python-2.7.2/Lib/ctypes/__init__.py 2012-08-30 13:40:38.837698797 +0200
4+
@@ -272,31 +272,34 @@
5+
else:
6+
set_conversion_mode("ascii", "strict")
7+
8+
- class c_wchar_p(_SimpleCData):
9+
- _type_ = "Z"
10+
-
11+
- class c_wchar(_SimpleCData):
12+
- _type_ = "u"
13+
-
14+
- POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param
15+
-
16+
- def create_unicode_buffer(init, size=None):
17+
- """create_unicode_buffer(aString) -> character array
18+
- create_unicode_buffer(anInteger) -> character array
19+
- create_unicode_buffer(aString, anInteger) -> character array
20+
- """
21+
- if isinstance(init, (str, unicode)):
22+
- if size is None:
23+
- size = len(init)+1
24+
- buftype = c_wchar * size
25+
- buf = buftype()
26+
- buf.value = init
27+
- return buf
28+
- elif isinstance(init, (int, long)):
29+
- buftype = c_wchar * init
30+
- buf = buftype()
31+
- return buf
32+
- raise TypeError(init)
33+
+# The wchar stuff causes a crash on Android (the bionic C library doesn't
34+
+# implement wchar_t anyway)
35+
+#
36+
+# class c_wchar_p(_SimpleCData):
37+
+# _type_ = "Z"
38+
+#
39+
+# class c_wchar(_SimpleCData):
40+
+# _type_ = "u"
41+
+#
42+
+# POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param
43+
+#
44+
+# def create_unicode_buffer(init, size=None):
45+
+# """create_unicode_buffer(aString) -> character array
46+
+# create_unicode_buffer(anInteger) -> character array
47+
+# create_unicode_buffer(aString, anInteger) -> character array
48+
+# """
49+
+# if isinstance(init, (str, unicode)):
50+
+# if size is None:
51+
+# size = len(init)+1
52+
+# buftype = c_wchar * size
53+
+# buf = buftype()
54+
+# buf.value = init
55+
+# return buf
56+
+# elif isinstance(init, (int, long)):
57+
+# buftype = c_wchar * init
58+
+# buf = buftype()
59+
+# return buf
60+
+# raise TypeError(init)
61+
62+
POINTER(c_char).from_param = c_char_p.from_param #_SimpleCData.c_char_p_from_param
63+

0 commit comments

Comments
 (0)
0