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

BUG: Fix Index.putmask makes stack overflow with an invalid mask #18407

Merged
merged 6 commits into from
Nov 25, 2017

Conversation

Licht-T
Copy link
Contributor

@Licht-T Licht-T commented Nov 21, 2017

@codecov
Copy link

codecov bot commented Nov 21, 2017

Codecov Report

Merging #18407 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18407      +/-   ##
==========================================
- Coverage   91.33%   91.29%   -0.05%     
==========================================
  Files         163      163              
  Lines       49752    49754       +2     
==========================================
- Hits        45443    45424      -19     
- Misses       4309     4330      +21
Flag Coverage Δ
#multiple 89.09% <100%> (-0.03%) ⬇️
#single 40.71% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/base.py 96.4% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/plotting/_converter.py 63.44% <0%> (-1.82%) ⬇️
pandas/core/frame.py 97.8% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be66ef8...cd84337. Read the comment docs.

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Nov 22, 2017
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.

pls add a whatsnew note (0.21.1 is ok)

# coerces to object
return self.astype(object).putmask(mask, value)
except (ValueError, TypeError) as err:
if self.dtype == np.dtype(object):
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 use is_object_dtype

except (ValueError, TypeError) as err:
if self.dtype == np.dtype(object):
raise err
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

just use the return here, no else is needed

@Licht-T Licht-T force-pushed the fix-index-putmask-stack-overflow branch from 683dab7 to 0b71ffe Compare November 25, 2017 13:57
@Licht-T
Copy link
Contributor Author

Licht-T commented Nov 25, 2017

@jreback Thanks! Fixed!

@jreback jreback added this to the 0.21.1 milestone Nov 25, 2017
@jreback
Copy link
Contributor

jreback commented Nov 25, 2017

lgtm. ping on green.

@jreback jreback merged commit b69c1a2 into pandas-dev:master Nov 25, 2017
@jreback
Copy link
Contributor

jreback commented Nov 25, 2017

thanks @Licht-T keep em coming!

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Dec 8, 2017
TomAugspurger pushed a commit that referenced this pull request Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index.putmask with an invalid mask causes a crash due to stack overflow
3 participants