Skip to content

Commit 24d3ac0

Browse files
committed
Merge pull request #7 from mdboom/sfntname-missing
SfntNames.get_name() raises KeyError if missing
2 parents 3f53ce6 + 2c80e05 commit 24d3ac0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docstrings/sfntnames.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
4343
This searches the SFNT names to first find a Unicode version of the
4444
name, if available, otherwise returning the first found name of the
45-
given type. Returns `None` if no name of the given type was found.
45+
given type. Raises `KeyError` if no name of the given type was found.
4646
4747
Parameters
4848
----------

src/sfntnames.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Py_SfntNames_get_name(Py_SfntNames* self, PyObject* args, PyObject* kwds) {
129129
}
130130
}
131131

132-
Py_RETURN_NONE;
132+
return PyErr_Format(PyExc_KeyError, "No name of type %d", name);
133133
};
134134

135135

0 commit comments

Comments
 (0)