Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2680e7

Browse files
committed
Raise TypeError instead where appropriate.
1 parent 1134029 commit a2680e7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎module.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static PyObject *object_call(ObjectData *self, PyObject *args, PyObject *kwds) {
144144
return NULL;
145145
}
146146
} else {
147-
PyErr_Format(PyExc_ValueError,
147+
PyErr_Format(PyExc_TypeError,
148148
"Unsupported type of argument %d when calling quickjs object: %s.",
149149
i,
150150
Py_TYPE(item)->tp_name);
@@ -235,7 +235,7 @@ static PyObject *quickjs_to_python(ContextData *context_obj, JSValue value) {
235235
object->context = context_obj;
236236
object->object = JS_DupValue(context, value);
237237
} else {
238-
PyErr_Format(PyExc_ValueError, "Unknown quickjs tag: %d", tag);
238+
PyErr_Format(PyExc_TypeError, "Unknown quickjs tag: %d", tag);
239239
}
240240

241241
JS_FreeValue(context, value);

‎test_quickjs.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def test_function_call_unsupported_arg(self):
191191
return 40 + x;
192192
}
193193
""")
194-
with self.assertRaisesRegex(ValueError, "Unsupported type"):
194+
with self.assertRaisesRegex(TypeError, "Unsupported type"):
195195
self.assertEqual(f({}), 42)
196196

197197
def test_json(self):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /