Skip to content

maybe_upcast_putmask: require other to be a scalar #29332

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
Nov 2, 2019

Conversation

jbrockmendel
Copy link
Member

ATM all places where we use maybe_upcast_putmask have other as a scalar. By making that into a requirement for the function, we can rule out the possibility of passing non-scalar other into maybe_promote (xref #29331).

Note: there are some simplifications within maybe_upcast_putmask that this makes possible that I did not implement in this PR.

cc @jreback @h-vetinari

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. small followon typing request.

@@ -232,7 +232,7 @@ def trans(x):
return result


def maybe_upcast_putmask(result, mask, other):
def maybe_upcast_putmask(result: np.ndarray, mask: np.ndarray, other):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you type other 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.

looks like ill be doing a branch of just follow-ups soon

@jreback jreback added the Dtype Conversions Unexpected or buggy dtype conversions label Nov 2, 2019
@jreback jreback added this to the 1.0 milestone Nov 2, 2019
@jreback jreback merged commit 023fa0c into pandas-dev:master Nov 2, 2019
@jbrockmendel jbrockmendel deleted the maybe_upcast branch November 2, 2019 15:34
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants