-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-28557: error message for bad raw readinto #7496
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Improve the error message for a misbehaving ``rawio.readinto`` |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1483,6 +1483,15 @@ _bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len) | |||||
} | ||||||
n = PyNumber_AsSsize_t(res, PyExc_ValueError); | ||||||
Py_DECREF(res); | ||||||
|
||||||
if (n == -1 && PyErr_Occurred()) { | ||||||
davidszotten marked this conversation as resolved.
Show resolved
Hide resolved
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.
Suggested change
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. i don't quite understand why, but removing that check i get a segfault here's the bottom of the stack from lldb:
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. hang on, i think i get it now. the point is that the whole point of this pr is to help users debug bad 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. Yes sorry, this was a mistake :/ |
||||||
_PyErr_FormatFromCause( | ||||||
PyExc_OSError, | ||||||
"raw readinto() failed" | ||||||
); | ||||||
return -1; | ||||||
} | ||||||
|
||||||
if (n < 0 || n > len) { | ||||||
PyErr_Format(PyExc_OSError, | ||||||
"raw readinto() returned invalid length %zd " | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.