Segmentation fault for Font(fontbuffer=object()) (original) (raw)

Please provide all mandatory information!

Describe the bug (mandatory)

fitz.Font(fontbuffer=object()) causes a segmentation fault.

To Reproduce (mandatory)

See above.

Expected behavior (optional)

It should raise a TypeError or something.

Your configuration (mandatory)

Python 3.9.1, wheel.

Additional context (optional)

This is not how the library is supposed to be used, but mistakes can happen (for example pass a fontTools.TTFont object in), and segmentation faults are annoying in Python (normally it would print a traceback and let the user catch it)

To generalize, perhaps there should be some way to make the functions that take AnyType arguments safe from user errors?