Skip to content

CLN: Exception in NDFrame._maybe_update_cacher #29066

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 8 commits into from
Oct 22, 2019
6 changes: 5 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3353,9 +3353,13 @@ def _maybe_update_cacher(self, clear=False, verify_is_copy=True):
if ref is None:
del self._cacher
else:
# Note: we need to call ref._maybe_cache_changed even in the
# case where it will raise. (Uh, not clear why)
try:
ref._maybe_cache_changed(cacher[0], self)
except Exception:
except AssertionError:
Copy link
Contributor

Choose a reason for hiding this comment

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

does this raise in the test suite?

Copy link
Member Author

Choose a reason for hiding this comment

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

moved the first assertion to the else block to clarify that it is not the assertion that is raising.

There are places in the test suite where the ref._maybe_cache_changed call raises an AssertionError because of a shape mismatch, but AFAICT checking for that situation and only calling it in non-raising cases breaks several tests

# ref._data.setitem can raise
# AssertionError because of shape mismatch
pass

if verify_is_copy:
Expand Down