aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/include-mapping/cppreference_parser.py
diff options
context:
space:
mode:
authorCassie Jones <cassie_jones@apple.com>2023-09-12 14:24:35 -0400
committerGitHub <noreply@github.com>2023-09-12 11:24:35 -0700
commit7213ae8423f88a3f74e201f85900aa838a4143e3 (patch)
tree2527a1ad606a6e8af89381e86bbe2c5aba40a2b2 /clang/tools/include-mapping/cppreference_parser.py
parent6eadc8f16e03f6aa3b1b1c178c308ac452eabeac (diff)
downloadllvm-7213ae8423f88a3f74e201f85900aa838a4143e3.zip
llvm-7213ae8423f88a3f74e201f85900aa838a4143e3.tar.gz
llvm-7213ae8423f88a3f74e201f85900aa838a4143e3.tar.bz2
[include-mapping] Python fixes
- Move the multiprocessing.Pool initializer to a top-level function, it was previously causing a pickle failure with my machine's python. - Change the `env python` to `env python3` for convenience
Diffstat (limited to 'clang/tools/include-mapping/cppreference_parser.py')
-rw-r--r--clang/tools/include-mapping/cppreference_parser.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/tools/include-mapping/cppreference_parser.py b/clang/tools/include-mapping/cppreference_parser.py
index cefdbea..f2ea553 100644
--- a/clang/tools/include-mapping/cppreference_parser.py
+++ b/clang/tools/include-mapping/cppreference_parser.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# ===- cppreference_parser.py - ------------------------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -176,6 +176,10 @@ def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
return symbols
+def signal_ignore_initializer():
+ return signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+
def GetSymbols(parse_pages):
"""Get all symbols by parsing the given pages.
@@ -192,9 +196,7 @@ def GetSymbols(parse_pages):
symbols = []
# Run many workers to process individual symbol pages under the symbol index.
# Don't allow workers to capture Ctrl-C.
- pool = multiprocessing.Pool(
- initializer=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)
- )
+ pool = multiprocessing.Pool(initializer=signal_ignore_initializer)
try:
for root_dir, page_name, namespace in parse_pages:
symbols.extend(