Skip to content

BUG: handle case when StringDType na_object is nan in float to string cast #28228

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 1 commit into from
Jan 27, 2025

Conversation

ngoldbaum
Copy link
Member

Fixes #28157.

@ngoldbaum
Copy link
Member Author

Unfortunately I don't think this can be easily backported without re-doing the PR inside the macro in the casts.c.src file that used to implement this operation. If anyone wants to do that, feel free, but given that this can be worked around I don't mind waiting for 2.3 to release this fix.

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. I only have a nitpick for the implementation, so approving.

"to string cast");
goto fail;
}
goto next_step;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd tend to just move the old code into an else { clause and thus avoid the goto here.

Copy link
Member Author

Choose a reason for hiding this comment

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

But then you never store the scalar if the scalar value isn't the na_object, unless you add an else clause for the if (na_object) block that duplicates the code storing the scalar value. IMO the goto is better since there's less copy/pasted code.

@ngoldbaum ngoldbaum merged commit cb8b623 into numpy:main Jan 27, 2025
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: StringDType: na_object ignored in full
2 participants