diff -r 89821243621b Modules/posixmodule.c --- a/Modules/posixmodule.c Thu Jul 14 07:45:24 2016 +0300 +++ b/Modules/posixmodule.c Thu Jul 14 17:25:12 2016 +0800 @@ -12319,6 +12319,8 @@ path_repr = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); + if (NULL == path_repr) + return NULL; if (!(PyUnicode_Check(path_repr) || PyBytes_Check(path_repr))) { PyErr_Format(PyExc_TypeError, "expected %.200s.__fspath__() to return str or bytes, "