diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-26 18:17:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-26 19:29:45 +0300 |
commit | b94efe0e8b785598933d9f506b965068652fb579 (patch) | |
tree | 347398d496648ba07874ea620dd71e67c7b450cc /source | |
parent | 7bc6fbf158556331e247b714f874b919b9af9ae7 (diff) |
BGE: remove Py3.1 workaround
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/VideoTexture/ImageBase.cpp | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 0d46160a11e..5a07b84fa12 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -713,25 +713,19 @@ static int Image_getbuffer(PyImage *self, Py_buffer *view, int flags) unsigned int * image; int ret; - try - { + try { // can throw in case of resize image = self->m_image->getImage(); } - catch (Exception & exp) - { + catch (Exception & exp) { // cannot return -1, this creates a crash in Python, for now we will just return an empty buffer exp.report(); - //return -1; - goto error; + return -1; } - if (!image) - { - // same remark, see above - //PyErr_SetString(PyExc_BufferError, "Image buffer is not available"); - //return -1; - goto error; + if (!image) { + PyErr_SetString(PyExc_BufferError, "Image buffer is not available"); + return -1; } if (view == NULL) { @@ -742,17 +736,6 @@ static int Image_getbuffer(PyImage *self, Py_buffer *view, int flags) if (ret >= 0) self->m_image->m_exports++; return ret; - -error: - // Return a empty buffer to avoid a crash in Python 3.1 - // The bug is fixed in Python SVN 77916, as soon as the python revision used by Blender is - // updated, you can simply return -1 and set the error - static char* buf = (char *)""; - ret = PyBuffer_FillInfo(view, (PyObject *)self, buf, 0, 0, flags); - if (ret >= 0) - self->m_image->m_exports++; - return ret; - } static void Image_releaseBuffer(PyImage *self, Py_buffer *buffer) |