From a04367dbca3db988d025e89f22eae9c9d6914814 Mon Sep 17 00:00:00 2001
From: Manuel Gunther <siebenkopf@googlemail.com>
Date: Tue, 19 Sep 2017 10:06:29 -0600
Subject: [PATCH] Propagating Unicode error if existent.

---
 bob/io/base/file.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bob/io/base/file.cpp b/bob/io/base/file.cpp
index 8856bac..fc2622a 100644
--- a/bob/io/base/file.cpp
+++ b/bob/io/base/file.cpp
@@ -73,12 +73,14 @@ int PyBobIo_FilenameConverter (PyObject* o, const char** b) {
     *b = PyUnicode_AsUTF8(o);
   } else {
     PyObject* temp = PyObject_Bytes(o);
+    if (!temp) return 0;
     auto temp_ = make_safe(temp);
     *b = PyBytes_AsString(temp);
   }
 #else
   if (PyUnicode_Check(o)) {
     PyObject* temp = PyUnicode_AsEncodedString(o, Py_FileSystemDefaultEncoding, "strict");
+    if (!temp) return 0;
     auto temp_ = make_safe(temp);
     *b = PyString_AsString(temp);
   } else {
-- 
GitLab