-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
bpo-15988: make various overflow messages more consistent and helpful #668
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 1 commit
f9a126f
37fc195
c35fc35
b6cc2ea
bba2087
fbb56ab
8091b62
f36f579
343b679
bb97755
34e34ab
a88ecc5
07387ec
458dbc7
dca2943
f752b12
043ea7e
499ffc3
82f3125
f0b59b7
abb2977
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…Arg_* funcs in mmapmodule.c
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -412,7 +412,7 @@ poll_register(pollObject *self, PyObject *args) | |
| assert(PyErr_Occurred()); | ||
| if (PyErr_ExceptionMatches(PyExc_OverflowError)) { | ||
| PyErr_SetString(PyExc_OverflowError, | ||
| "register: eventmask value does not fit in C " | ||
| "eventmask value does not fit in C " | ||
|
Member
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. It would be easier to rename
Contributor
Author
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. all right, I will remove this change, and other similar changes where |
||
| "unsigned short"); | ||
| } | ||
| return NULL; | ||
|
|
@@ -462,7 +462,7 @@ poll_modify(pollObject *self, PyObject *args) | |
| assert(PyErr_Occurred()); | ||
| if (PyErr_ExceptionMatches(PyExc_OverflowError)) { | ||
| PyErr_SetString(PyExc_OverflowError, | ||
| "modify: eventmask value does not fit in C " | ||
| "eventmask value does not fit in C " | ||
| "unsigned short"); | ||
| } | ||
| return NULL; | ||
|
|
@@ -808,8 +808,8 @@ internal_devpoll_register(devpollObject *self, PyObject *args, int remove) | |
| assert(PyErr_Occurred()); | ||
| if (PyErr_ExceptionMatches(PyExc_OverflowError)) { | ||
| PyErr_SetString(PyExc_OverflowError, | ||
| "register/modify: eventmask value does not fit " | ||
| "in C unsigned short"); | ||
| "eventmask value does not fit in C " | ||
| "unsigned short"); | ||
| } | ||
| return NULL; | ||
| } | ||
|
|
||
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.
This change looks unrelated to this issue. It is rather related to bpo-28261.
And avoid using "dunder" names. The user directly calls
mmap(), notmmap.__new__().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.
why is it related to bpo-28261?
ISTM that currently the error messages are inconsistent:
the patches change it to:
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.
At best, it would be the same 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.
I can't think of a simple way to achieve that, as the overflow happens inside PyArg_ParseTupleAndKeywords, but it could happen in 4 different arguments, so new_mmap_object can't know in which of the arguments the overflow happened.
that's why I made the patch in seterror(). that was the best simple solution I could come up with.