Skip to content

Commit 04e9681

Browse files
Workaround for Python issue (#3546)
1 parent 35f3b60 commit 04e9681

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

codespell_lib/_codespell.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import re
2626
import sys
2727
import textwrap
28-
from ctypes import wintypes
2928
from typing import (
3029
Any,
3130
Dict,
@@ -40,6 +39,12 @@
4039
Tuple,
4140
)
4241

42+
if sys.platform == "win32":
43+
from ctypes import wintypes
44+
45+
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
46+
STD_OUTPUT_HANDLE = wintypes.HANDLE(-11)
47+
4348
from ._spellchecker import Misspelling, build_dict
4449
from ._text_util import fix_case
4550

@@ -138,10 +143,6 @@
138143
EX_DATAERR = 65
139144
EX_CONFIG = 78
140145

141-
# Windows specific constants
142-
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
143-
STD_OUTPUT_HANDLE = wintypes.HANDLE(-11)
144-
145146
# OPTIONS:
146147
#
147148
# ARGUMENTS:

0 commit comments

Comments
 (0)