Uh oh!
There was an error while loading. Please reload this page.
gh-130821: Make error messages consistent in Modules/ - #144737
gh-130821: Make error messages consistent in Modules/#144737Cityfishman wants to merge 1 commit into
Conversation
Update error messages in Modules/ directory to use consistent format with %T formatter for type names, similar to changes made in PR python#130835 for Objects/ directory. Changes: - Modules/_abc.c: items() error message - Modules/_datetimemodule.c: divmod() error message - Modules/_pickle.c: read() error message - Modules/_io/bufferedio.c: read() and readall() error messages - Modules/_io/iobase.c: read() error message - Modules/_io/textio.c: decoder and encoder error messages - Modules/_csv.c: iterator error message
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
| @@ -1302,8 +1302,8 @@ _Unpickler_ReadIntoFromFile(PickleState *state, UnpicklerObject *self, char *buf | |||
| } | |||
| if (!PyBytes_Check(data)) { | |||
| PyErr_Format(PyExc_ValueError, | |||
There was a problem hiding this comment.
It seems strange that this raises a ValueError and not a TypeError since the error is that the return value of read() is not a bytes object, but instead a different type. Not sure the potential impact of changing this from a ValueError to a TypeError, but a TypeError feels like the better option as it makes it consistent with all the other changes in this PR and also in #130835.
This PR is stale because it has been open for 30 days with no activity. |
Update error messages in Modules/ directory to use consistent format with %T formatter for type names, similar to changes made in PR #130835 for Objects/ directory.
Changes: