Skip to content

ENH/API: Keep original traceback in DataFrame.apply #4549

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

bburan-galenea
Copy link
Contributor

When "raise " is used inside a try/except block, the
original stacktrace (containing the code path that raised the original
exception). This makes debugging difficult since all we know is that an error
occured when frame._apply_standard attempted to call the provided function.
Preserve the original stacktrace by using "raise" instead of "raise ". This facilitates debugginb by allowing us to see where (in the
provided callable) the exception occured.

@cpcloud
Copy link
Member

cpcloud commented Aug 13, 2013

can you set up travis ci and add a test? thx

@bburan-galenea
Copy link
Contributor Author

I set up Travis CI, but it won't run until I push a new commit (which I'll do once I add a test). As for the test, do you have any pointers on how one might be able to test that a traceback is the appropriate one? I'm not sure how one might go about doing this so any tips will be very helpful.

@jtratner
Copy link
Contributor

We discussed this before in #4254 (which is talking about the same issue - but didn't get set up for Travis). Don't really need to have a test case for traceback, because it's not really something you can or should test.

@cpcloud
Copy link
Member

cpcloud commented Aug 13, 2013

right...now i remember. ok then

@bburan-galenea
Copy link
Contributor Author

Ok, in that case how do I force Travis to run since there's nothing new to commit? Should I delete this pull request/commit and start over? It looks like Travis is set up OK with my account as far as I can tell.

@jreback
Copy link
Contributor

jreback commented Aug 13, 2013

git commit --amend -C HEAD
git push origin mybranch -f

will reset the commit hash

@bburan-galenea
Copy link
Contributor Author

Done. Let me know if you need anything else. Looks like the build passed.

@jtratner
Copy link
Contributor

@jreback @cpcloud this is good (and worthwhile) to merge. And @cpcloud note that it actually fixes the issue you had to mess with to resolve #4403 😁

@jreback
Copy link
Contributor

jreback commented Aug 21, 2013

@bburan-galenea I know this is trivial, but can you put a release notes mention ? (so we don't forget when this was actually changed)? thanks...then can merge

@bburan-galenea
Copy link
Contributor Author

Certainly. Do you mean edit https://github.com/pydata/pandas/blob/master/doc/source/release.rst and add a note under "bug fixes"?

@jtratner
Copy link
Contributor

@bburan-galenea yes, that's correct.

When "raise <exception instance>" is used inside a try/except block, the
original stacktrace (containing the code path that raised the original
exception).  This makes debugging difficult since all we know is that an error
occured when `frame._apply_standard` attempted to call the provided function.
Preserve the original stacktrace by using "raise" instead of "raise <exception
instance>".  This facilitates debugginb by allowing us to see where (in the
provided callable) the exception occured.

Added mention of this change in release notes
@bburan-galenea
Copy link
Contributor Author

Ok, I added the note to release.rst and squashed the commits together.

@jreback
Copy link
Contributor

jreback commented Aug 21, 2013

can you add the original issue in the release notes as well, #4254? which this PR will close

@jreback
Copy link
Contributor

jreback commented Aug 21, 2013

never mind, that is another PR that looks like a dup of yours (or maybe yours is a dupe of his!) either way...

@bburan-galenea
Copy link
Contributor Author

Thanks!

jreback added a commit that referenced this pull request Aug 21, 2013
…eption_traceback

ENH/API: Keep original traceback in DataFrame.apply
@jreback jreback merged commit da85a3c into pandas-dev:master Aug 21, 2013
@jreback
Copy link
Contributor

jreback commented Aug 21, 2013

thank you sir!

keep em coming

@bburan-galenea bburan-galenea deleted the bburan-galenea/apply_exception_traceback branch August 21, 2013 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants