From b604899217780156737188da1e712f31e6fb03ae Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 10 Apr 2025 23:01:43 -0600 Subject: [PATCH] Make NotShareableError inherit from TypeError. --- Python/crossinterp_exceptions.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Python/crossinterp_exceptions.h b/Python/crossinterp_exceptions.h index 39993648f275f4..857c4d1e379a0e 100644 --- a/Python/crossinterp_exceptions.h +++ b/Python/crossinterp_exceptions.h @@ -46,14 +46,13 @@ static PyTypeObject _PyExc_InterpreterNotFoundError = { }; PyObject *PyExc_InterpreterNotFoundError = (PyObject *)&_PyExc_InterpreterNotFoundError; -/* NotShareableError extends ValueError */ +/* NotShareableError extends TypeError */ static int _init_notshareableerror(exceptions_t *state) { const char *name = "interpreters.NotShareableError"; - // XXX Inherit from TypeError. - PyObject *base = PyExc_ValueError; + PyObject *base = PyExc_TypeError; PyObject *ns = NULL; PyObject *exctype = PyErr_NewException(name, base, ns); if (exctype == NULL) { @@ -94,7 +93,7 @@ _ensure_notshareableerror(PyThreadState *tstate, } } else { - exctype = PyExc_ValueError; + exctype = PyExc_TypeError; } _PyErr_SetObject(tstate, exctype, msgobj); // We have to set the context manually since _PyErr_SetObject() doesn't.