diff --git a/docstrings/sfntnames.py b/docstrings/sfntnames.py index 4fab8a4..c6f021e 100644 --- a/docstrings/sfntnames.py +++ b/docstrings/sfntnames.py @@ -42,7 +42,7 @@ This searches the SFNT names to first find a Unicode version of the name, if available, otherwise returning the first found name of the -given type. Returns `None` if no name of the given type was found. +given type. Raises `KeyError` if no name of the given type was found. Parameters ---------- diff --git a/src/sfntnames.c b/src/sfntnames.c index b2ccd57..93f8193 100644 --- a/src/sfntnames.c +++ b/src/sfntnames.c @@ -129,7 +129,7 @@ Py_SfntNames_get_name(Py_SfntNames* self, PyObject* args, PyObject* kwds) { } } - Py_RETURN_NONE; + return PyErr_Format(PyExc_KeyError, "No name of type %d", name); };