Hi, Jim Kleckner wrote: > I ran across an annoyance and wondered if anyone else hit this. > > I have some compiled C code wrapped with Cython that writes to > an ordinary file descriptor when the debug level is high enough. > It directly references sys.stdout and sends output there. When > using a doctest, however, that object is replaced with _SpoofOut > that subclasses StringIO. Thus, when executing something like the > following in a doctest: > > ... > cdef file outFile = sys.stdout # This fails for the spoofed output > callDebugCodeInC(PyFile_AsFile(outFile)) > ... > > It (understandably) fails on the assignment with a message: > TypeError: Cannot convert instance to file
Note that PyFile_AsFile() was dropped in Py3 anyway, so your code will not be future-proof if you use this. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
