Repository navigation
Conversation
Change-Id: I33d667ffe4ea65f1cc2031a158afcb27446ded0d
Change-Id: Ibfbdeb0f0aaf2ddfce809d67952e4b30a4ecc2c5
Change-Id: I940f50bc5632d6c2c06f1abbe130908149c68c61
Member
|
Hi @wesm , sorry for the delay but I was out of town. I looked into this and the problem isn't that exc returns null, but it's a tuple with (error code, message) and then I tried the below patch and it seems to work because diff --git a/cpp/src/arrow/python/io.cc b/cpp/src/arrow/python/io.cc
index ba82a45..114c3df 100644
--- a/cpp/src/arrow/python/io.cc
+++ b/cpp/src/arrow/python/io.cc
@@ -45,10 +45,13 @@ static Status CheckPyError() {
if (PyErr_Occurred()) {
PyObject *exc_type, *exc_value, *traceback;
PyErr_Fetch(&exc_type, &exc_value, &traceback);
- PyObjectStringify stringified(exc_value);
- std::string message(stringified.bytes);
+ PyErr_NormalizeException(&exc_type, &exc_value, &traceback);
+ PyObject *exc_value_str = PyObject_Str(exc_value);
+ char *c_str = PyString_AsString(exc_value_str);
+ std::string message(c_str);
Py_XDECREF(exc_type);
Py_XDECREF(exc_value);
+ Py_XDECREF(exc_value_str);
Py_XDECREF(traceback);
PyErr_Clear();
return Status::IOError(message); |
Member
Author
|
Cool, thanks for digging into this. Would you submit this as a patch? Thanks! |
jeffknupp
pushed a commit
to jeffknupp/arrow
that referenced
this pull request
Jun 3, 2017
cc @BryanCutler. This was a tricky one. I am not sure how to reproduce with our current code -- I reverted the patch from ARROW-822 to get a reproduction so I could fix this. Now, the error raised is: ``` /home/wesm/code/arrow/python/pyarrow/_error.pyx in pyarrow._error.check_status (/home/wesm/code/arrow/python/build/temp.linux-x86_64-2.7/_error.cxx:1324)() 58 raise ArrowInvalid(message) 59 elif status.IsIOError(): ---> 60 raise ArrowIOError(message) 61 elif status.IsOutOfMemory(): 62 raise ArrowMemoryError(message) ArrowIOError: IOError: Error message was null ``` I'm not sure why calling `tell` on the socket object results in a bad exception state, but in any case it seems that the result of `PyErr_Fetch` cannot be relied upon to be non-null even when `PyErr_Occurred()` returns non-null Author: Wes McKinney <wes.mckinney@twosigma.com> Closes apache#606 from wesm/ARROW-866 and squashes the following commits: fa395cd [Wes McKinney] Enable other kinds of Status errors to be returned 0bd11c2 [Wes McKinney] Consolidate error handling code a bit 9d59dd2 [Wes McKinney] Be robust to PyErr_Fetch returning a null exc value
pribor
pushed a commit
to GlobalWebIndex/arrow
that referenced
this pull request
Oct 24, 2025
…/release.sh` (apache#606) Fixes apacheGH-603. Message from Git: hint: You have created a nested tag. The object referred to by your new tag is hint: already a tag. If you meant to tag the object that it points to, use: hint: hint: git tag -f v18.2.0 v18.2.0-rc5^{} hint: Disable this message with "git config advice.nestedTag false"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc @BryanCutler. This was a tricky one. I am not sure how to reproduce with our current code -- I reverted the patch from ARROW-822 to get a reproduction so I could fix this. Now, the error raised is:
I'm not sure why calling
tellon the socket object results in a bad exception state, but in any case it seems that the result ofPyErr_Fetchcannot be relied upon to be non-null even whenPyErr_Occurred()returns non-null