Skip to content

Commit 6a110c0

Browse files
committed
Log _MSVC_LANG on MSVC
1 parent 71bcc9d commit 6a110c0

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎Lib/test/test_cext/extension.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ module_exec(PyObject *module)
373373
return -1;
374374
}
375375
#endif
376+
#ifdef _MSVC_LANG
377+
if (PyModule_AddIntMacro(module, _MSVC_LANG) < 0) {
378+
return -1;
379+
}
380+
#endif
381+
// Ignore "unused argument" warning when none of these macros is defined
382+
(void)module;
376383
return 0;
377384
}
378385

‎Lib/test/test_cext/runtests.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ def run_tests(testmod, verbose=True):
99
if not name.startswith('test'):
1010
continue
1111
func = getattr(testmod, name)
12-
if verbose:
13-
print(f"{name}()")
12+
print(f"{name}()")
1413
func()
1514

1615
print("add()")
1716
if testmod.add(11, 23) != 34:
1817
raise AssertionError("add() failed badly")
1918

20-
if verbose:
21-
print(flush=True)
19+
print(flush=True)
2220

2321

2422
def main():
@@ -29,6 +27,18 @@ def main():
2927

3028
testmod = importlib.import_module(module_name)
3129

30+
newline = False
31+
for name in ('__STDC_VERSION__', '__cplusplus', '_MSVC_LANG'):
32+
try:
33+
value = getattr(testmod, name)
34+
except AttributeError:
35+
pass
36+
else:
37+
print(f'{name}: {value}')
38+
newline = True
39+
if newline:
40+
print()
41+
3242
if hasattr(sys, 'gettotalrefcount'):
3343
# First run to warm up Python. For example, test_datetime() imports
3444
# the datetime module.

0 commit comments

Comments
 (0)