Skip to content

Commit dba0bb3

Browse files
authored
Merge branch 'main' into jit_float_truediv
2 parents d2c03bc + dea4083 commit dba0bb3

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

Doc/library/argparse.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,15 @@ User defined functions can be used as well:
11181118

11191119
The :func:`bool` function is not recommended as a type converter. All it does
11201120
is convert empty strings to ``False`` and non-empty strings to ``True``.
1121-
This is usually not what is desired.
1121+
This is usually not what is desired::
1122+
1123+
>>> parser = argparse.ArgumentParser()
1124+
>>> _ = parser.add_argument('--verbose', type=bool)
1125+
>>> parser.parse_args(['--verbose', 'False'])
1126+
Namespace(verbose=True)
1127+
1128+
See :class:`BooleanOptionalAction` or ``action='store_true'`` for common
1129+
alternatives.
11221130

11231131
In general, the ``type`` keyword is a convenience that should only be used for
11241132
simple conversions that can only raise one of the three supported exceptions.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix building the jit stencils on Windows when the interpreter is built with
2+
a different clang version. Patch by Chris Eibl.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Expand :mod:`argparse` documentation for ``type=bool`` with a demonstration
2+
of the surprising behavior and pointers to common alternatives.

Tools/jit/_llvm.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,19 @@ async def _run(tool: str, args: typing.Iterable[str], echo: bool = False) -> str
4242
async with _CORES:
4343
if echo:
4444
print(shlex.join(command))
45+
46+
if os.name == "nt":
47+
# When building with /p:PlatformToolset=ClangCL, the VS build
48+
# system puts that clang's include path into INCLUDE. The JIT's
49+
# clang may be a different version, and mismatched headers cause
50+
# build errors. See https://github.com/python/cpython/issues/146210.
51+
env = os.environ.copy()
52+
env.pop("INCLUDE", None)
53+
else:
54+
env = None
4555
try:
4656
process = await asyncio.create_subprocess_exec(
47-
*command, stdout=subprocess.PIPE
57+
*command, stdout=subprocess.PIPE, env=env
4858
)
4959
except FileNotFoundError:
5060
return None

0 commit comments

Comments
 (0)