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

Don't use deprecated numpy APIs #3547

Merged
merged 14 commits into from Oct 17, 2014
Merged

Conversation

jkseppan
Copy link
Member

There are three main things about the deprecated APIs:

  • some macros have been renamed, e.g. PyArray_UINT8 to NPY_UINT8
  • you can't access PyArrayObject fields directly, instead you have to use accessor functions
  • the old accessor macros are now functions so you can't call them with a PyObject* without typecasting

This changes the Travis configuration to require numpy==1.6 in one build, to ensure that we stay compatible with the version advertised in documentation. This also adds #defines to make reliance on the deprecated APIs a compilation error.

Fixes #2092.

@mdboom
Copy link
Member

mdboom commented Sep 22, 2014

I like this. astropy is currently doing something very similar, though more controversially since astropy is still trying to support numpy >= 1.5.

I have no problems with this, as it seems to pass all tests.

@jkseppan
Copy link
Member Author

One small thing: I noticed that this causes a massive number of warnings when compiling _macosx.m. Apparently the implicit cast on function call is legal Objective-C but produces a warning, whereas it's an error in C (or is it only in C++?). I could fix those errors before merging.

@jkseppan
Copy link
Member Author

I tried that last commit by running IPython --pylab with the MacOSX backend and executing examples/pylab_examples/quadmesh_demo.py, examples/pylab_examples/tripcolor_demo.py and examples/api/histogram_path_demo.py. All demos seemed to work fine.

@mdboom
Copy link
Member

mdboom commented Sep 22, 2014

Cc: @mdehoon

@jkseppan jkseppan mentioned this pull request Sep 23, 2014
Thanks to @mdehoon for catching these!
@tacaswell tacaswell modified the milestone: v1.5.x Oct 17, 2014
@jkseppan
Copy link
Member Author

Since I fixed the problems found by @mdehoon and no one else has objected, is this ready to merge? I agree with @tacaswell's milestone of 1.5.x, there should be no need to backport to 1.4.x.

@tacaswell
Copy link
Member

cc @mdboom I bet this conflicts with your massive cxx removal effort...

@mdboom
Copy link
Member

mdboom commented Oct 17, 2014

@tacaswell: Yes, it probably does. It's going to be a pretty manual merge process, but at least I'll have this as a guide. It doesn't hurt to merge this, but it is likely to be short-lived.

@tacaswell tacaswell merged commit b279c15 into matplotlib:master Oct 17, 2014
tacaswell added a commit that referenced this pull request Oct 17, 2014
Conflicts:
	src/_path.cpp

Conflicted with bug fix for picking zero length path collection 5e2b03c
PR #3592
@tacaswell
Copy link
Member

Manually resolved the conflict and merged.

@jkseppan jkseppan deleted the numpy-deprecation branch October 19, 2014 05:15
@QuLogic QuLogic modified the milestones: v1.5.0, 2.1 (next point release) Oct 16, 2016
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.

Move to new Numpy API
5 participants