summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2019-03-25 21:50:58 +0100
committerGitHub <noreply@github.com>2019-03-25 21:50:58 +0100
commit027b09c5a13aac9e14a3b43bb385298d549c3833 (patch)
tree44c35e9ec4e1ae42dde580a0ea369e5a1c32de1a /Python/sysmodule.c
parentd1e768a67707bf7bb426c1537e1a764e89eaff78 (diff)
downloadcpython-git-027b09c5a13aac9e14a3b43bb385298d549c3833.tar.gz
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 4351a7fb37..3df4d44a7c 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -283,7 +283,9 @@ sys_displayhook(PyObject *module, PyObject *o)
builtins = _PyImport_GetModuleId(&PyId_builtins);
if (builtins == NULL) {
- PyErr_SetString(PyExc_RuntimeError, "lost builtins module");
+ if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_RuntimeError, "lost builtins module");
+ }
return NULL;
}
Py_DECREF(builtins);