diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 1b0a84b..284cf6e 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -889,8 +892,10 @@ initstdio(void) /* Set builtins.open */ if (PyObject_SetAttrString(bimod, "open", wrapper) == -1) { + Py_DECREF(wrapper); goto error; } + Py_DECREF(wrapper); encoding = Py_GETENV("PYTHONIOENCODING"); errors = NULL;