10000 Merge pull request #21407 from anntzer/cfe · matplotlib/matplotlib@1f7b6d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f7b6d1

Browse files
authored
Merge pull request #21407 from anntzer/cfe
Stash exceptions when FT2Font closes the underlying stream.
2 parents 79b3232 + 6a2cc9d commit 1f7b6d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ft2font_wrapper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ static unsigned long read_from_file_callback(FT_Stream stream,
296296

297297
static void close_file_callback(FT_Stream stream)
298298
{
299+
PyObject *type, *value, *traceback;
300+
PyErr_Fetch(&type, &value, &traceback);
299301
PyFT2Font *self = (PyFT2Font *)stream->descriptor.pointer;
300302
PyObject *close_result = NULL;
301303
if (!(close_result = PyObject_CallMethod(self->py_file, "close", ""))) {
@@ -307,6 +309,7 @@ static void close_file_callback(FT_Stream stream)
307309
if (PyErr_Occurred()) {
308310
PyErr_WriteUnraisable((PyObject*)self);
309311
}
312+
PyErr_Restore(type, value, traceback);
310313
}
311314

312315
static PyTypeObject PyFT2FontType;

0 commit comments

Comments
 (0)
0