From 04e96818c0b43c66543b15f7df8bcda1c082fe7d Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:00:13 +0200 Subject: [PATCH] Workaround for Python issue (#3546) --- codespell_lib/_codespell.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/codespell_lib/_codespell.py b/codespell_lib/_codespell.py index 7198e99e9e..8e9165ff95 100644 --- a/codespell_lib/_codespell.py +++ b/codespell_lib/_codespell.py @@ -25,7 +25,6 @@ import re import sys import textwrap -from ctypes import wintypes from typing import ( Any, Dict, @@ -40,6 +39,12 @@ Tuple, ) +if sys.platform == "win32": + from ctypes import wintypes + + ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 + STD_OUTPUT_HANDLE = wintypes.HANDLE(-11) + from ._spellchecker import Misspelling, build_dict from ._text_util import fix_case @@ -138,10 +143,6 @@ EX_DATAERR = 65 EX_CONFIG = 78 -# Windows specific constants -ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 -STD_OUTPUT_HANDLE = wintypes.HANDLE(-11) - # OPTIONS: # # ARGUMENTS: