summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-08-30 19:40:20 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-08-30 19:40:20 (GMT)
commit326e189410106de22c4af9d8449e0a8dc631c7dc (patch)
treeaee14795e7baf029f61b898631d32af264782be3 /Lib/ctypes
parentcaa745e7ca238313293de8cfe183df3d92f18cc9 (diff)
downloadcpython-326e189410106de22c4af9d8449e0a8dc631c7dc.zip
cpython-326e189410106de22c4af9d8449e0a8dc631c7dc.tar.gz
cpython-326e189410106de22c4af9d8449e0a8dc631c7dc.tar.bz2
Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to
some functions like file.write().
Diffstat (limited to 'Lib/ctypes')
-rw-r--r--Lib/ctypes/test/test_buffers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_buffers.py b/Lib/ctypes/test/test_buffers.py
index c19c05a..2dc7484 100644
--- a/Lib/ctypes/test/test_buffers.py
+++ b/Lib/ctypes/test/test_buffers.py
@@ -20,6 +20,10 @@ class StringBufferTestCase(unittest.TestCase):
self.assertEqual(b[::2], b"ac")
self.assertEqual(b[::5], b"a")
+ def test_buffer_interface(self):
+ self.assertEqual(len(bytearray(create_string_buffer(0))), 0)
+ self.assertEqual(len(bytearray(create_string_buffer(1))), 1)
+
try:
c_wchar
except NameError: