Author: Brian Kearns <bdkea...@gmail.com>
Branch: 
Changeset: r70062:3c1786c06a69
Date: 2014-03-18 15:24 -0400
http://bitbucket.org/pypy/pypy/changeset/3c1786c06a69/

Log:    test/fix buffer init

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -195,11 +195,6 @@
         return None
 
     def buffer_w(self, space):
-        w_impl = space.lookup(self, '__buffer__')
-        if w_impl is not None:
-            w_result = space.get_and_call_function(w_impl, self)
-            if space.isinstance_w(w_result, space.w_buffer):
-                return w_result.buf
         self._typed_unwrap_error(space, "buffer")
 
     def str_w(self, space):
diff --git a/pypy/module/__builtin__/test/test_buffer.py 
b/pypy/module/__builtin__/test/test_buffer.py
--- a/pypy/module/__builtin__/test/test_buffer.py
+++ b/pypy/module/__builtin__/test/test_buffer.py
@@ -4,6 +4,12 @@
 class AppTestBuffer:
     spaceconfig = dict(usemodules=['array'])
 
+    def test_init(self):
+        class A(object):
+            def __buffer__(self):
+                return buffer('123')
+        raises(TypeError, buffer, A())
+
     def test_unicode_buffer(self):
         import sys
         b = buffer(u"ab")
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to