From: Dag Sverre Seljebotn <dagss@student.matnat.uio.no> Date: Sat, 2 Aug 2008 07:54:44 +0000 (+0200) Subject: Higher precision in utilcode usage in Buffer.py X-Git-Tag: 0.9.8.1~49^2~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b0b0fa6f6c25fd9cd800f26c0c4e6308b38ca24;p=cython.git Higher precision in utilcode usage in Buffer.py --- diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index 76e99efc..2bac70dc 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -212,6 +212,7 @@ def put_assign_to_buffer(lhs_cname, rhs_cname, buffer_aux, buffer_type, code.put('if (%s) ' % code.unlikely("%s == -1" % (getbuffer % lhs_cname))) code.begin_block() code.putln('Py_XDECREF(%s); Py_XDECREF(%s); Py_XDECREF(%s);' % (type, value, tb)) + code.globalstate.use_utility_code(raise_buffer_fallback_code) code.putln('__Pyx_RaiseBufferFallbackError();') code.putln('} else {') code.putln('PyErr_Restore(%s, %s, %s);' % (type, value, tb)) @@ -567,7 +568,6 @@ static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ static INLINE const char* __Pyx_BufferTypestringCheckEndian(const char* ts); /*proto*/ static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ """, """ static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; @@ -618,6 +618,11 @@ static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { expected_ndim, buffer->ndim); } +"""] + +raise_buffer_fallback_code = [""" +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ +""",""" static void __Pyx_RaiseBufferFallbackError(void) { PyErr_Format(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");