-
-
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
Conversation
@@ -1818,6 +1816,9 @@ def error(): | |||
except: | |||
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.
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.
In my last few commits this except clause hid the cause of the underlying exception.
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.
Cant it just be removed altogether and let exceptions raise as they occur onstead of goinc through error()?
@topper-123 well, maybe you're right!
Codecov Report
@@ Coverage Diff @@
## master #21558 +/- ##
==========================================
- Coverage 91.92% 91.92% -0.01%
==========================================
Files 153 153
Lines 49561 49561
==========================================
- Hits 45559 45557 -2
- Misses 4002 4004 +2
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.23.2.txt
Outdated
@@ -61,6 +61,7 @@ Bug Fixes | |||
|
|||
- Bug in :meth:`Index.get_indexer_non_unique` with categorical key (:issue:`21448`) | |||
- Bug in comparison operations for :class:`MultiIndex` where error was raised on equality / inequality comparison involving a MultiIndex with ``nlevels == 1`` (:issue:`21149`) | |||
- The backtrace from a ``KeyError`` is now shorted and clearer (:issue:`21557`) |
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.
can you be a little more clear here :> (this is when indexing!)
backtrace -> traceback
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.
I think this should go in 0.24 as this might require a tricky backport (maybe) as the refactored code is in 0.24
@@ -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 comment
The 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 comment
The 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.
thanks @toobaz |
git diff upstream/master -u -- "*.py" | flake8 --diff