Skip to content

Commit 0ef12d5

Browse files
adam-grant-hendryLee-W
authored andcommitted
fix(out.py): TextIOWrapper.reconfigure typing
See python/typeshed#3049
1 parent d885af4 commit 0ef12d5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

commitizen/out.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import io
12
import sys
23

34
from termcolor import colored
45

56
if sys.platform == "win32":
6-
# See: https://github.com/python/typeshed/issues/3049
7-
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
7+
if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info >= (3, 7):
8+
sys.stdout.reconfigure(encoding="utf-8")
89

910

1011
def write(value: str, *args) -> None:

0 commit comments

Comments
 (0)