Commit 94f7b0eb authored by Stefan Behnel's avatar Stefan Behnel

reduce number of distinct error format strings a bit

parent f8233ea5
...@@ -201,7 +201,7 @@ static PyObject* __Pyx_Intern(PyObject* s); /* proto */ ...@@ -201,7 +201,7 @@ static PyObject* __Pyx_Intern(PyObject* s); /* proto */
static PyObject* __Pyx_Intern(PyObject* s) { static PyObject* __Pyx_Intern(PyObject* s) {
if (!(likely(PyString_CheckExact(s)))) { if (!(likely(PyString_CheckExact(s)))) {
PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(s)->tp_name); PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(s)->tp_name);
return 0; return 0;
} }
Py_INCREF(s); Py_INCREF(s);
......
...@@ -288,7 +288,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject * o) { ...@@ -288,7 +288,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject * o) {
PyObject *value = NULL; PyObject *value = NULL;
if (!PyMapping_Check(o)) { if (!PyMapping_Check(o)) {
PyErr_Format(PyExc_TypeError, "Expected a mapping, not %s", o->ob_type->tp_name); PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "a mapping", Py_TYPE(o)->tp_name);
goto bad; goto bad;
} }
......
...@@ -87,7 +87,7 @@ def test_obj_to_struct(MyStruct mystruct): ...@@ -87,7 +87,7 @@ def test_obj_to_struct(MyStruct mystruct):
>>> test_obj_to_struct(None) >>> test_obj_to_struct(None)
Traceback (most recent call last): Traceback (most recent call last):
... ...
TypeError: Expected a mapping, not NoneType TypeError: Expected a mapping, got NoneType
>>> test_obj_to_struct(dict(s=b"world")) >>> test_obj_to_struct(dict(s=b"world"))
Traceback (most recent call last): Traceback (most recent call last):
... ...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment