Skip to content

Navigation Menu

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

MAINT: Remove any promotion-state switching logic #27156

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

Merged
merged 4 commits into from
Aug 31, 2024

Conversation

seberg
Copy link
Member

@seberg seberg commented Aug 9, 2024

This is the first level, no following code simplifications, just straight up deletions of any branching.

I kept a UserWarning, in case someone had the bad idea to permanently set the environment variable and think they can rely on it. Although would be happy to just delete that as well.


I don't really think this interferes with regularly touched code, so think we might as well do it now and not worry about backports (the diff isn't huge anyway)

This is the first level, no following code simplifications, just
straight up deletions of any branching.

I kept a UserWarning, in case someone had the bad idea to permanently
set the environment variable and think they can rely on it.
Although would be happy to just delete that as well.
I think we can just do that, but maybe it's prudent to just point
it out anyway...
Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

Always love deleting almost a thousand lines of sort of complicated C code. I left a few minor comments but this looks good.

numpy/_core/src/multiarray/convert_datatype.c Show resolved Hide resolved
numpy/_core/src/multiarray/multiarraymodule.c Show resolved Hide resolved
numpy/_core/tests/test_numeric.py Show resolved Hide resolved
Copy link
Member

@mattip mattip left a comment

Choose a reason for hiding this comment

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

LGTM, and the documentation changes make sense. I will leave this for a bit if anyone else wants to take a look.

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

Looks good, but there are quite a few comments by @ngoldbaum that are unresolved (though most/all are addressed?), so just approving, not merging.

Also one tiny nitpick - not worth running CI on its own, but can be done if there are other changes to be made still.

if weak_promotion and expected_weak is not None:
expected = expected_weak

other, expected):
Copy link
Contributor

Choose a reason for hiding this comment

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

Bring back to one line?

@ngoldbaum
Copy link
Member

Sorry for not giving this another pass! Looks good to me now. @seberg feel free to merge along with Marten's suggested fixup.

@@ -529,8 +529,11 @@ def hugepage_setup():
_core.multiarray._multiarray_umath._reload_guard()

# TODO: Remove the environment variable entirely now that it is "weak"
_core._set_promotion_state(
os.environ.get("NPY_PROMOTION_STATE", "weak"))
if (os.environ.get("NPY_PROMOTION_STATE", "weak") != "weak"):

Choose a reason for hiding this comment

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

Assign "weak" to a variable like DEFAULT_PROMOTION_STATE for better maintainability and readability.

@seberg seberg merged commit b3ddf2f into numpy:main Aug 31, 2024
35 of 41 checks passed
charris pushed a commit to charris/numpy that referenced this pull request Sep 15, 2024
This is the first level, no following code simplifications, just
straight up deletions of any branching.

I kept a UserWarning, in case someone had the bad idea to permanently
set the environment variable and think they can rely on it.
Although would be happy to just delete that as well.

* DOC: Add release note for promotion state removal

I think we can just do that, but maybe it's prudent to just point
it out anyway...

* DOC: Mention semi-private removed functions and tweak docs

* Adress Marten's last comment
@charris
Copy link
Member

charris commented Sep 15, 2024

@seberg I put up a backport for this (#27397) in order to simplify some other backports.

@seberg
Copy link
Member Author

seberg commented Sep 16, 2024

Hmmm, this removes the ability to use the env variable, so not sure about back-porting.

@charris
Copy link
Member

charris commented Sep 16, 2024

@seberrg OK, I'll skip a backport for now.

ArvidJB pushed a commit to ArvidJB/numpy that referenced this pull request Nov 1, 2024
This is the first level, no following code simplifications, just
straight up deletions of any branching.

I kept a UserWarning, in case someone had the bad idea to permanently
set the environment variable and think they can rely on it.
Although would be happy to just delete that as well.

* DOC: Add release note for promotion state removal

I think we can just do that, but maybe it's prudent to just point
it out anyway...

* DOC: Mention semi-private removed functions and tweak docs

* Adress Marten's last comment
@seberg seberg deleted the delete-promotion-state branch November 14, 2024 12:06
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.

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