Before this change, the function would only accept a string object (specifying a filename), or a file object (apparently wrapping a FILE object from \<stdio.h\>). For the file object case, it was only ever passed to PyObject_AsFileDescriptor() via apr_file_from_object(). It should be fine to remove the file object check because PyObject_AsFileDescriptor() handles figuring out if the object has a fileno() method or not. And Python 3 does not have a specific file type anyway.

Having looked at this code closely now, I’m wondering about the PyBytes_AsString() call to get the file name: perhaps it should accept text strings instead, or maybe both types like most Python APIs use. I’ll have a go at fixing that up, but this is my first real encounter with the Python C API and I haven’t been able to trigger the open_tmp_file_func() callback to test it. Apparently it might only be used in older versions of Subversion.