Vajrasky Kok added the comment: It happens because if the length of data is more than 1000:
def __write(self, line): """line is always bytes, not string""" if self.__file is not None: if self.__file.tell() + len(line) > 1000: self.file = self.make_file() data = self.__file.getvalue() self.file.write(data) self.__file = None ...... it will create a temporary file. Attached the patch to close the temporary file in the destructor method. About the 1000 number, should we put it in constant? Why 1000? This number is so random. For now, I just leave it as it is. ---------- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file31239/fix_resource_warning_in_test_cgi.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18394> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com