Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docstrings/sfntnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
3 changes: 2 additions & 1 deletion src/sfntnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ Py_SfntNames_get_name(Py_SfntNames* self, PyObject* args, PyObject* kwds) {
}
}

Py_RETURN_NONE;
PyErr_Format(PyExc_KeyError, "No name of type %d", name);
return NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Learning the c-api very slowly. https://docs.python.org/3.5/c-api/exceptions.html#c.PyErr_Format says it always returns NULL, could this be simplified to

return PyErr_Format(PyExc_KeyError, "No name of type %d", name);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. That's not a bad idea.

};


Expand Down