Skip to content

Commit 90a77f7

Browse files
committed
Use sysconfig.get_config_var
1 parent f36f722 commit 90a77f7

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

mypy/report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import shutil
1010
import sys
11+
import sysconfig
1112
import time
1213
import tokenize
1314
from abc import ABCMeta, abstractmethod
@@ -25,7 +26,7 @@
2526
from mypy.version import __version__
2627

2728
try:
28-
if sys.version_info >= (3, 14) and not sys._is_gil_enabled():
29+
if sys.version_info >= (3, 14) and not bool(sysconfig.get_config_var("Py_GIL_DISABLED")):
2930
# lxml doesn't support free-threading yet
3031
LXML_INSTALLED = False
3132
else:

mypy/test/testcheck.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import re
77
import sys
8+
import sysconfig
89
import tempfile
910
from pathlib import Path
1011

@@ -27,7 +28,7 @@
2728
from mypy.test.update_data import update_testcase_output
2829

2930
try:
30-
if sys.version_info >= (3, 14) and not sys._is_gil_enabled():
31+
if sys.version_info >= (3, 14) and not bool(sysconfig.get_config_var("Py_GIL_DISABLED")):
3132
# lxml doesn't support free-threading yet
3233
lxml = None
3334
else:

mypy/test/testcmdline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import re
1111
import subprocess
1212
import sys
13+
import sysconfig
1314

1415
from mypy.test.config import PREFIX, test_temp_dir
1516
from mypy.test.data import DataDrivenTestCase, DataSuite
@@ -20,7 +21,7 @@
2021
)
2122

2223
try:
23-
if sys.version_info >= (3, 14) and not sys._is_gil_enabled():
24+
if sys.version_info >= (3, 14) and not bool(sysconfig.get_config_var("Py_GIL_DISABLED")):
2425
# lxml doesn't support free-threading yet
2526
lxml = None
2627
else:

mypy/test/testreports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from __future__ import annotations
44

55
import sys
6+
import sysconfig
67
import textwrap
78

89
from mypy.report import CoberturaPackage, get_line_rate
910
from mypy.test.helpers import Suite, assert_equal
1011

1112
try:
12-
if sys.version_info >= (3, 14) and not sys._is_gil_enabled():
13+
if sys.version_info >= (3, 14) and not bool(sysconfig.get_config_var("Py_GIL_DISABLED")):
1314
# lxml doesn't support free-threading yet
1415
lxml = None
1516
else:

0 commit comments

Comments
 (0)