Skip to content

Commit da4d656

Browse files
authored
closes bpo-39870: Remove unused arg from sys_displayhook_unencodable. (pythonGH-18796)
Also move int err to its innermost scope.
1 parent ce305d6 commit da4d656

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/sysmodule.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ PyDoc_STRVAR(breakpointhook_doc,
551551
552552
Helper function for sys_displayhook(). */
553553
static int
554-
sys_displayhook_unencodable(PyThreadState *tstate, PyObject *outf, PyObject *o)
554+
sys_displayhook_unencodable(PyObject *outf, PyObject *o)
555555
{
556556
PyObject *stdout_encoding = NULL;
557557
PyObject *encoded, *escaped_str, *repr_str, *buffer, *result;
@@ -624,7 +624,6 @@ sys_displayhook(PyObject *module, PyObject *o)
624624
PyObject *outf;
625625
PyObject *builtins;
626626
static PyObject *newline = NULL;
627-
int err;
628627
PyThreadState *tstate = _PyThreadState_GET();
629628

630629
builtins = _PyImport_GetModuleId(&PyId_builtins);
@@ -652,10 +651,11 @@ sys_displayhook(PyObject *module, PyObject *o)
652651
}
653652
if (PyFile_WriteObject(o, outf, 0) != 0) {
654653
if (_PyErr_ExceptionMatches(tstate, PyExc_UnicodeEncodeError)) {
654+
int err;
655655
/* repr(o) is not encodable to sys.stdout.encoding with
656656
* sys.stdout.errors error handler (which is probably 'strict') */
657657
_PyErr_Clear(tstate);
658-
err = sys_displayhook_unencodable(tstate, outf, o);
658+
err = sys_displayhook_unencodable(outf, o);
659659
if (err) {
660660
return NULL;
661661
}

0 commit comments

Comments
 (0)