summaryrefslogtreecommitdiffstats
path: root/Python/crossinterp_exceptions.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2025-04-25 21:10:43 (GMT)
committerGitHub <noreply@github.com>2025-04-25 21:10:43 (GMT)
commit8a4d4f37abb9fa639fdc5d7003c4067904cdcc6b (patch)
treea307838ef9502e631eb5980025a9ec324b5b5b94 /Python/crossinterp_exceptions.h
parentcd9536a0872046cc7c151b61b457975e7718274a (diff)
downloadcpython-8a4d4f37abb9fa639fdc5d7003c4067904cdcc6b.zip
cpython-8a4d4f37abb9fa639fdc5d7003c4067904cdcc6b.tar.gz
cpython-8a4d4f37abb9fa639fdc5d7003c4067904cdcc6b.tar.bz2
gh-132781: Make NotShareableError a TypeError Subclass (gh-132973)
It was a subclass of ValueError. However, shareability is a feature of types, not values.
Diffstat (limited to 'Python/crossinterp_exceptions.h')
-rw-r--r--Python/crossinterp_exceptions.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/Python/crossinterp_exceptions.h b/Python/crossinterp_exceptions.h
index 3999364..857c4d1 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.