diff options
author | Andy Lester <andy@petdance.com> | 2020-03-06 04:34:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 04:34:36 (GMT) |
commit | da4d656e951b00580d135ae6345656ecedf9d8d4 (patch) | |
tree | 9c3c9e17305839b284ff27be633c67e45ab06574 | |
parent | ce305d641074931e4e790f7a83e28f74910644e5 (diff) | |
download | cpython-da4d656e951b00580d135ae6345656ecedf9d8d4.zip cpython-da4d656e951b00580d135ae6345656ecedf9d8d4.tar.gz cpython-da4d656e951b00580d135ae6345656ecedf9d8d4.tar.bz2 |
closes bpo-39870: Remove unused arg from sys_displayhook_unencodable. (GH-18796)
Also move int err to its innermost scope.
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index cacff52..bfacf31 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -551,7 +551,7 @@ PyDoc_STRVAR(breakpointhook_doc, Helper function for sys_displayhook(). */ static int -sys_displayhook_unencodable(PyThreadState *tstate, PyObject *outf, PyObject *o) +sys_displayhook_unencodable(PyObject *outf, PyObject *o) { PyObject *stdout_encoding = NULL; PyObject *encoded, *escaped_str, *repr_str, *buffer, *result; @@ -624,7 +624,6 @@ sys_displayhook(PyObject *module, PyObject *o) PyObject *outf; PyObject *builtins; static PyObject *newline = NULL; - int err; PyThreadState *tstate = _PyThreadState_GET(); builtins = _PyImport_GetModuleId(&PyId_builtins); @@ -652,10 +651,11 @@ sys_displayhook(PyObject *module, PyObject *o) } if (PyFile_WriteObject(o, outf, 0) != 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_UnicodeEncodeError)) { + int err; /* repr(o) is not encodable to sys.stdout.encoding with * sys.stdout.errors error handler (which is probably 'strict') */ _PyErr_Clear(tstate); - err = sys_displayhook_unencodable(tstate, outf, o); + err = sys_displayhook_unencodable(outf, o); if (err) { return NULL; } |