summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-07-12 14:58:32 (GMT)
committerThomas Heller <theller@ctypes.org>2007-07-12 14:58:32 (GMT)
commit3af4266d07c38a136858acd63fe663d24590400c (patch)
tree57a1cfb0191b8d4b392557195cdea0c690c0e9af /Lib
parentf7c6d868325b999c32ec759934eac7a96c4b56fd (diff)
downloadcpython-3af4266d07c38a136858acd63fe663d24590400c.zip
cpython-3af4266d07c38a136858acd63fe663d24590400c.tar.gz
cpython-3af4266d07c38a136858acd63fe663d24590400c.tar.bz2
ctypes.c_char and ctypes.c_wchar now accept initialization from byte objects.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_bytes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_bytes.py b/Lib/ctypes/test/test_bytes.py
new file mode 100644
index 0000000..778fe09
--- /dev/null
+++ b/Lib/ctypes/test/test_bytes.py
@@ -0,0 +1,18 @@
+import unittest
+from ctypes import *
+
+class BytesTest(unittest.TestCase):
+ def test_c_char(self):
+ x = c_char(b"x")
+ x.value = b"y"
+ c_char.from_param(b"x")
+ (c_char * 3)(b"a", b"b", b"c")
+
+ def test_c_wchar(self):
+ x = c_wchar(b"x")
+ x.value = b"y"
+ c_wchar.from_param(b"x")
+ (c_wchar * 3)(b"a", b"b", b"c")
+
+if __name__ == '__main__':
+ unittest.main()