Index: scripts/Python/python-typemaps.swig =================================================================== --- scripts/Python/python-typemaps.swig +++ scripts/Python/python-typemaps.swig @@ -520,16 +520,7 @@ } } else - { - PythonFile py_file(PyRefType::Borrowed, $input); - File file; - if (!py_file.GetUnderlyingFile(file)) - return nullptr; - - $1 = file.GetStream(); - if ($1) - file.Clear(); - } + $1 = PyFile_AsFile($input); } %typemap(out) FILE * {