-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: Raise a simpler backtrace for missing key #21558
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1807,8 +1807,6 @@ def error(): | |
|
||
try: | ||
key = self._convert_scalar_indexer(key, axis) | ||
if not ax.contains(key): | ||
error() | ||
except TypeError as e: | ||
|
||
# python 3 type errors should be raised | ||
|
@@ -1818,6 +1816,9 @@ def error(): | |
except: | ||
error() | ||
|
||
if not ax.contains(key): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it possible to add a test for this (maybe compare the exception message)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately comparing the message is not enough (it didn't change - and is already tested). We would have to check the traceback, and I have no idea of how to do it - and if we want to do it. |
||
error() | ||
|
||
def _is_scalar_access(self, key): | ||
# this is a shortcut accessor to both .loc and .iloc | ||
# that provide the equivalent access of .at and .iat | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my last few commits this except clause hid the cause of the underlying exception. Cant it just be removed altogether and let exceptions raise as they occur onstead of goinc through error()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, in principle this is its exact goal ;-) Can you provide an example? I guess we should just specify the exceptions it catches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@topper-123 well, maybe you're right!