summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-04-03 16:58:39 (GMT)
committerGitHub <noreply@github.com>2024-04-03 16:58:39 (GMT)
commit976bcb2379709da57073a9e07b518ff51daa617a (patch)
tree66fca9084cbae6c0b503491f627829d703df19bc /Modules
parent7ecd55d604a8fa287c1d131cac14d10260be826b (diff)
downloadcpython-976bcb2379709da57073a9e07b518ff51daa617a.zip
cpython-976bcb2379709da57073a9e07b518ff51daa617a.tar.gz
cpython-976bcb2379709da57073a9e07b518ff51daa617a.tar.bz2
gh-76785: Raise InterpreterError, Not RuntimeError (gh-117489)
I had meant to switch everything to InterpreterError when I added it a while back. At the time I missed a few key spots. As part of this, I've added print-the-exception to _PyXI_InitTypes() and fixed an error case in `_PyStaticType_InitBuiltin().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_xxsubinterpretersmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 9c2774e..94b8ee35 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -612,7 +612,7 @@ interp_create(PyObject *self, PyObject *args, PyObject *kwds)
// XXX Move the chained exception to interpreters.create()?
PyObject *exc = PyErr_GetRaisedException();
assert(exc != NULL);
- PyErr_SetString(PyExc_RuntimeError, "interpreter creation failed");
+ PyErr_SetString(PyExc_InterpreterError, "interpreter creation failed");
_PyErr_ChainExceptions1(exc);
return NULL;
}
@@ -664,7 +664,7 @@ interp_destroy(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}
if (interp == current) {
- PyErr_SetString(PyExc_RuntimeError,
+ PyErr_SetString(PyExc_InterpreterError,
"cannot destroy the current interpreter");
return NULL;
}
@@ -673,7 +673,7 @@ interp_destroy(PyObject *self, PyObject *args, PyObject *kwds)
/* XXX We *could* support destroying a running interpreter but
aren't going to worry about it for now. */
if (is_running_main(interp)) {
- PyErr_Format(PyExc_RuntimeError, "interpreter running");
+ PyErr_Format(PyExc_InterpreterError, "interpreter running");
return NULL;
}
@@ -693,7 +693,7 @@ PyDoc_STRVAR(destroy_doc,
\n\
Destroy the identified interpreter.\n\
\n\
-Attempting to destroy the current interpreter results in a RuntimeError.\n\
+Attempting to destroy the current interpreter raises InterpreterError.\n\
So does an unrecognized ID.");