summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2006-06-08 17:00:45 (GMT)
committerBrett Cannon <bcannon@gmail.com>2006-06-08 17:00:45 (GMT)
commitde3b0522160df86b45075708cd42a0e7d62a9b71 (patch)
treed7060f822e992ef943d421deb0b52cb5b8b85df0 /Lib
parent6ee7d01c059f799c0f52ffe94811507bccc688a2 (diff)
downloadcpython-de3b0522160df86b45075708cd42a0e7d62a9b71.zip
cpython-de3b0522160df86b45075708cd42a0e7d62a9b71.tar.gz
cpython-de3b0522160df86b45075708cd42a0e7d62a9b71.tar.bz2
Buffer objects would return the read or write buffer for a wrapped object when
the char buffer was requested. Now it actually returns the char buffer if available or raises a TypeError if it isn't (as is raised for the other buffer types if they are not present but requested). Not a backport candidate since it does change semantics of the buffer object (although it could be argued this is enough of a bug to bother backporting).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_types.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index c575c0c..f0bdfde 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -276,3 +276,10 @@ else: raise TestFailed, "buffer assignment should raise TypeError"
try: a[0:1] = 'g'
except TypeError: pass
else: raise TestFailed, "buffer slice assignment should raise TypeError"
+
+# array.array() returns an object that does not implement a char buffer,
+# something which int() uses for conversion.
+import array
+try: int(buffer(array.array('c')))
+except TypeError :pass
+else: raise TestFailed, "char buffer (at C level) not working"