Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DEP: Remove noprefix.h #12402

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

Closed
wants to merge 2 commits into from
Closed

DEP: Remove noprefix.h #12402

wants to merge 2 commits into from

Conversation

mattip
Copy link
Member

@mattip mattip commented Nov 16, 2018

We have yet another backward-compatible shim of defines to replace npy_* with *, for instance npy_byte with byte. It was useful during a transition period long ago but should no longer be used since it could cause name conflicts. Will conflict with #12401

@charris
Copy link
Member

charris commented Nov 16, 2018

Why remove the file? I'd just leave it in indefinitely.

@charris
Copy link
Member

charris commented Nov 16, 2018

Its use is managed by NPY_API_VERSION.

@mattip
Copy link
Member Author

mattip commented Nov 16, 2018

Are you sure it is managed by NPY_API_VERSION? It can be included manually (as per the comment at the top of the file) or by defining NPY_NO_PREFIX and including arrayobject.h. I could find no uses of either of those mechanisms in the rest of the codebase.

I would like to clean up dead code in the codebase.

  • A cleaner codebase makes it easier for new developers to join the team
  • We should encourage only one set of names for functions, macros, and variables. Having many ways to do things is confusing and leads to unested code paths.

Some of the macros in this 10 year old file look dangerous in 2018, like assuming MAX is a macro not a function, and redefining byte and uint without thought to if they are already defined.

@charris
Copy link
Member

charris commented Nov 16, 2018

Yeah, you are right about NPY_API_VERSION. But I still think it is a bad idea to remove it, in retrospect I think it was also a bad idea to remove the numeric compatibility module, which I did for the same reasons as you put forth. The numarray removal went OK, but I suspect that was because STSci was one of the few users, the numeric removal actually had to be delayed a year on account on one user, and we still caught Konrad Hinsen by surprise.

@charris
Copy link
Member

charris commented Nov 16, 2018

Maybe we can start with a warning on import? https://stackoverflow.com/questions/3826832/is-there-a-portable-way-to-print-a-message-from-the-c-preprocessor.

Or we could even make it an error for 1.16 and see if there are any complaints, we can always fix it in a microversion down the line.

Unfortunately, I think few would notice a warning in a C compilation...

@mattip mattip changed the title Remove noprefix.h DEP: Remove noprefix.h Dec 2, 2018
@rgommers
Copy link
Member

rgommers commented Dec 3, 2018

We definitely cannot remove this for 1.17.0, it will break too much. The rationale for this in #12402 (comment) is fair, but I'm afraid we need a longer time scale as well as warnings and actively removing this stuff from at least high-profile code bases like SciPy (already done, thanks @mattip) and Matplotlib. And opening issues on other usage we find with codesearch.com.

A deprecation warning in 1.16, and removal in 1.18 seems to be the minimum - 2 releases and 1 year of heads up at least.

@charris
Copy link
Member

charris commented Dec 3, 2018

Sounds like we might want to leave this in indefinitely with a warning. We should mention the sed script tools/replace_old_macros.sed that should fix most uses.

@tylerjereddy
Copy link
Contributor

I think the removal in SciPy is breaking wheel builds -- I'm inclined to revert the removal for 1.2.0

@charris
Copy link
Member

charris commented Dec 4, 2018

Thinking about this some more, I've come around to being -1 on removing noprefix.h. True, there is an advantage to downstream projects in using type names that identify themselves as belonging to numpy, but I don't think that justifies our forcing that transition on them. The decision should be theirs, not ours. We might remind them to fix things up, even offer help, but I don't think it should be a numpy project, the change isn't necessary.

@mattip
Copy link
Member Author

mattip commented Dec 11, 2018

A code search turns up more.

All but two of the hist were false-positives: people who had forked or copied numpy, scipy, or matplotlib into their repos.

In any case I will close this for now, maybe we can bring it up again in some future cleanup.

@mattip mattip closed this Dec 11, 2018
@mattip mattip deleted the remove-noprefix.h branch March 4, 2019 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.