Skip to content

Commit f7abe5b

Browse files
committed
pythongh-124613, regrtest: Detect JIT build in build info
1 parent 6f4d64b commit f7abe5b

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Lib/test/libregrtest/utils.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def get_build_info():
300300

301301
config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
302302
cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
303-
cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') or ''
303+
cflags += ' ' + (sysconfig.get_config_var('PY_CFLAGS_NODIST') or '')
304304
ldflags_nodist = sysconfig.get_config_var('PY_LDFLAGS_NODIST') or ''
305305

306306
build = []
@@ -313,16 +313,35 @@ def get_build_info():
313313
# --with-pydebug
314314
build.append('debug')
315315

316-
if '-DNDEBUG' in (cflags + cflags_nodist):
316+
if '-DNDEBUG' in cflags:
317317
build.append('without_assert')
318318
else:
319319
build.append('release')
320320

321321
if '--with-assertions' in config_args:
322322
build.append('with_assert')
323-
elif '-DNDEBUG' not in (cflags + cflags_nodist):
323+
elif '-DNDEBUG' not in cflags:
324324
build.append('with_assert')
325325

326+
# --enable-experimental-jit
327+
tier2 = re.search('-D_Py_TIER2=([0-9]+)', cflags)
328+
if tier2:
329+
tier2 = int(tier2.group(1))
330+
if tier2 == 1:
331+
jit = 'JIT' # =yes
332+
elif tier2 == 2:
333+
jit = 'JIT=yes-off'
334+
elif tier2 == 4:
335+
jit = 'JIT=interpreter'
336+
elif tier2 == 6: # Secret option
337+
jit = 'JIT=interpreter-off'
338+
elif '-D_Py_JIT' in cflags:
339+
jit = 'JIT'
340+
else:
341+
jit = None
342+
if jit:
343+
build.append(jit)
344+
326345
# --enable-framework=name
327346
framework = sysconfig.get_config_var('PYTHONFRAMEWORK')
328347
if framework:

0 commit comments

Comments
 (0)