Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to make backend_gdk compatible with numpy 1.6 #5080

Merged
merged 2 commits into from Sep 26, 2015

Conversation

jkseppan
Copy link
Member

Fixes #5078, at least according to a quick test with import matplotlib.backends.backend_gdk

@tacaswell tacaswell added this to the next point release (1.5.0) milestone Sep 15, 2015
@OceanWolf
Copy link
Contributor

Hmm, trying to restart the 3.4 test but it doesn't want to... Travis says it restarted successfully, but it hasn't restarted...

return NULL;
}
#else
PyArray_BASE(array) = py_pixbuf;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to cast the py_pixbuf pointer into a PyObject pointer? py_pixbuf is type PyGObject*.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because PyArray_SetBaseObject expects a PyObject pointer as its second argument.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 16 Sep 2015, at 17:18, mdehoon notifications@github.com wrote:

In src/_backend_gdk.c #5080 (comment):

@@ -52,7 +52,15 @@ static PyObject *pixbuf_get_pixels_array(PyObject *self, PyObject *args)

 /* the array holds a ref to the pixbuf pixels through this wrapper*/
 Py_INCREF(py_pixbuf);
  • PyArray_SetBaseObject(array, (PyObject *)py_pixbuf);
    +#if NPY_API_VERSION >= 0x00000007
  • if (PyArray_SetBaseObject(array, (PyObject *)py_pixbuf) == -1) {
  •    Py_DECREF(py_pixbuf);
    
  •    Py_DECREF(array);
    
  •    return NULL;
    
  • }
    +#else
  • PyArray_BASE(array) = py_pixbuf;
    Yes, because PyArray_SetBaseObject expects a PyObject pointer as its second argument.

I guess the question is whether we need to do the cast in the #else branch too. It’s not required in C, but assigning to a pointer to a different type can cause a compiler warning, so it would be slightly cleaner to cast in that branch too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. That was the question I was asking.

@jkseppan jkseppan mentioned this pull request Sep 17, 2015
tacaswell added a commit that referenced this pull request Sep 26, 2015
BLD: Try to make backend_gdk compatible with numpy 1.6
@tacaswell tacaswell merged commit 0c11514 into matplotlib:master Sep 26, 2015
@tacaswell
Copy link
Member

All the tests pass and cleans up a corner-case failure mode.

@jkseppan jkseppan deleted the numpy16-gdk branch October 3, 2015 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants