From: Pete Grayson Date: Sun, 27 Sep 2020 21:41:11 +0000 (+0000) Subject: Repair colorama wrapping on non-Windows platforms (#1670) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/4d71d74a442ccc6c309a0667147997c1eeb755fd?hp=4d71d74a442ccc6c309a0667147997c1eeb755fd Repair colorama wrapping on non-Windows platforms (#1670) * Repair colorama wrapping on non-Windows platforms The wrap_stream_for_windows() function calls colorama.initialise.wrap_stream() function to apply colorama's magic to wrapper to the output stream. Except this wrapper is only applied on Windows platforms that need it, otherwise the original stream is returned as-is. The colorama wrapped stream lacks a detach() method, so a no-op lambda was being assigned to the wrapped stream. The problem is that the no-op lambda was being assigned unconditionally whether or not colorama actually returns a wrapped stream, thus replacing the original TextIOWrapper's detach() method. Replacing the detach() method with a no-op lambda is the root cause of the problem observed in #1664. The solution is to only assign the no-op detach() method if the stream lacks its own detach() method. Repairs #1664 ---