Skip to content

Commit 8a4d4f3

Browse files
gh-132781: Make NotShareableError a TypeError Subclass (gh-132973)
It was a subclass of ValueError. However, shareability is a feature of types, not values.
1 parent cd9536a commit 8a4d4f3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Python/crossinterp_exceptions.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ static PyTypeObject _PyExc_InterpreterNotFoundError = {
4646
};
4747
PyObject *PyExc_InterpreterNotFoundError = (PyObject *)&_PyExc_InterpreterNotFoundError;
4848

49-
/* NotShareableError extends ValueError */
49+
/* NotShareableError extends TypeError */
5050

5151
static int
5252
_init_notshareableerror(exceptions_t *state)
5353
{
5454
const char *name = "interpreters.NotShareableError";
55-
// XXX Inherit from TypeError.
56-
PyObject *base = PyExc_ValueError;
55+
PyObject *base = PyExc_TypeError;
5756
PyObject *ns = NULL;
5857
PyObject *exctype = PyErr_NewException(name, base, ns);
5958
if (exctype == NULL) {
@@ -94,7 +93,7 @@ _ensure_notshareableerror(PyThreadState *tstate,
9493
}
9594
}
9695
else {
97-
exctype = PyExc_ValueError;
96+
exctype = PyExc_TypeError;
9897
}
9998
_PyErr_SetObject(tstate, exctype, msgobj);
10099
// We have to set the context manually since _PyErr_SetObject() doesn't.

0 commit comments

Comments
 (0)