10000 gh-102406: replace exception chaining by PEP-678 notes in codecs by iritkatriel · Pull Request #102407 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102406: replace exception chaining by PEP-678 notes in codecs #102407

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

Merged
merged 7 commits into from
Mar 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
rename function
  • Loading branch information
iritkatriel committed Mar 3, 2023
commit 926872f91ca44460236a2f83c92ab521d3fc9e04
8 changes: 4 additions & 4 deletions Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ PyObject *PyCodec_StreamWriter(const char *encoding,
}

static void
wrap_codec_error(const char *operation,
const char *encoding)
add_note_to_codec_error(const char *operation,
const char *encoding)
{
PyObject *exc = PyErr_GetRaisedException();
PyObject *note = PyUnicode_FromFormat("%s with '%s' codec failed",
Expand Down Expand Up @@ -424,7 +424,7 @@ _PyCodec_EncodeInternal(PyObject *object,

result = PyObject_Call(encoder, args, NULL);
if (result == NULL) {
wrap_codec_error("encoding", encoding);
add_note_to_codec_error("encoding", encoding);
goto onError;
}

Expand Down Expand Up @@ -469,7 +469,7 @@ _PyCodec_DecodeInternal(PyObject *object,

result = PyObject_Call(decoder, args, NULL);
if (result == NULL) {
wrap_codec_error("decoding", encoding);
add_note_to_codec_error("decoding", encoding);
goto onError;
}
if (!PyTuple_Check(result) ||
Expand Down
0