File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -131,10 +131,23 @@ import sys
131131from typing import Optional
132132from native import ClassIR, FuncIR, Record
133133
134+ HAVE_TEST = False
134135if sys.version_info >= (3, 14):
135- from test.support import EqualToForwardRef
136- type_forward_ref = EqualToForwardRef
137- else:
136+ try:
137+ from test.support import EqualToForwardRef
138+ type_forward_ref = EqualToForwardRef
139+ HAVE_TEST = True
140+ except ImportError as e:
141+ # catch the case of a pymanager installed Python
142+ # without the test module. It is excluded by default
143+ # on Windows.
144+ msg = 'Missing "test" module.'
145+ if sys.platform == "win32":
146+ msg += (' Please install a version of Python with the test module'
147+ ' by running pymanager install --force PythonTest\\<version>')
148+ raise ImportError(msg) from e
149+
150+ if not HAVE_TEST:
138151 from typing import ForwardRef
139152 type_forward_ref = ForwardRef
140153
You can’t perform that action at this time.
0 commit comments