pypy/module/cpyext/test/test_buffer.py::AppTestBuffer::()::test_AsWriteBuffer
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0ed3a810>
def test_AsWriteBuffer(self):
import array
module = self.import_extension('buffer', [
('write_buffer_len', 'METH_O',
"""
void* buf;
Py_ssize_t buf_len;
if (PyObject_AsWriteBuffer(args, &buf, &buf_len) < 0) {
//PyErr_SetString(PyExc_ValueError, "bad value");
return NULL;
}
return PyLong_FromLong(buf_len);
""")])
> assert module.write_buffer_len(bytearray(b'123')) == 3
E (application-level) ValueError: __release_buffer__ called with a buffer not obtained from this object
[/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/test/test_buffer.py:21]:14: ValueError
---------- Captured stdout call ----------
Error in cpyext, CPython compatibility layer:
The function cpyext_bf_releasebuffer_bytearray was not supposed to fail
Fatal error in cpyext, CPython compatibility layer, calling cpyext_bf_releasebuffer_bytearray
Either report a bug or consider not using this particular extension
---------- Captured stderr call ----------
<function PyModule_Create2 at 0x0dab6710> DONE
<function cpyext_bf_getbuffer_bytearray at 0x0e44ab10> DONE
<function cpyext_bf_releasebuffer_bytearray at 0x0e44ab90>Traceback (most recent call last):
File "/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/api.py", line 1164, in wrapper_second_level
raise not_supposed_to_fail(pname)
File "/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/api.py", line 1018, in not_supposed_to_fail
raise SystemError
SystemError
File "/opt/pypy2.7-v7.3.22-linux32/lib_pypy/_ctypes/function.py", line 283, in f
return to_call(*args)
File "/buildbot/slave/own-linux-x86-32/build/rpython/rtyper/lltypesystem/ll2ctypes.py", line 895, in callback
return callback_internal(*cargs)
File "/buildbot/slave/own-linux-x86-32/build/rpython/rtyper/lltypesystem/ll2ctypes.py", line 872, in callback_internal
llres = container._callable(*llargs)
File "/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/api.py", line 990, in wrapper
return wrapper_second_level(callable, pname, *args)
File "/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/api.py", line 1186, in wrapper_second_level
state.check_and_raise_exception(always=True)
File "/buildbot/slave/own-linux-x86-32/build/pypy/module/cpyext/state.py", line 79, in check_and_raise_exception
raise operror
OpErrFmtNoArgs: [<W_TypeObject 'ValueError' at 0xc661690>: W_BaseExceptionUserWeakrefable([W_UnicodeObject('__release_buffer__ called with a buffer not obtained from this object')])]
<function PyLong_FromLong at 0x0dbf6e50> DONE
builder: own-linux-x86-32 build #9492+
test: pypy/module/cpyext/test/test_buffer.py::AppTestBuffer::()::test_AsWriteBuffer