8000 Use remove prefix instead of lstrip · python/cpython@8abbd9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8abbd9b

Browse files
committed
Use remove prefix instead of lstrip
1 parent edd0897 commit 8abbd9b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ jobs:
4747
${{ inputs.free-threading && '--disable-gil' || '' }} \
4848
--prefix=/opt/python-dev \
4949
--with-openssl="$(brew --prefix openssl@3.0)"
50-
- name: Build CPython for compiler warning check
51-
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
52-
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
5350
- name: Build CPython
5451
if : ${{ inputs.free-threading || inputs.os != 'macos-13' }}
5552
run: gmake -j8
53+
- name: Build CPython for compiler warning check
54+
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
55+
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
5656
- name: Display build info
5757
run: make pythoninfo
5858
- name: Check compiler warnings

.github/workflows/reusable-ubuntu.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ jobs:
7373
--enable-slower-safety
7474
--with-openssl=$OPENSSL_DIR
7575
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
76-
- name: Build CPython out-of-tree (for compiler warning check)
77-
if: ${{ !inputs.free-threading}}
78-
working-directory: ${{ env.CPYTHON_BUILDDIR }}
79-
run: set -o pipefail; make -j4 2>&1 | tee compiler_output_ubuntu.txt
8076
- name: Build CPython out-of-tree
8177
if: ${{ inputs.free-threading }}
8278
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8379
run: make -j4
80+
- name: Build CPython out-of-tree (for compiler warning check)
81+
if: ${{ !inputs.free-threading}}
82+
working-directory: ${{ env.CPYTHON_BUILDDIR }}
83+
run: set -o pipefail; make -j4 2>&1 | tee compiler_output_ubuntu.txt
8484
- name: Display build info
8585
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8686
run: make pythoninfo

Tools/build/check_warnings.py

Lines changed: 4 additions & 4 deletions
< 8000 tr class="diff-line-row">
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FileWarnings(NamedTuple):
1919

2020
def extract_warnings_from_compiler_output_clang(
2121
compiler_output: str,
22-
path_prefix: str | None = None,
22+
path_prefix: str = "",
2323
) -> list[dict]:
2424
"""
2525
Extracts warnings from the compiler output when using clang
@@ -34,7 +34,7 @@ def extract_warnings_from_compiler_output_clang(
3434
if match := clang_warning_regex.match(line):
3535
compiler_warnings.append(
3636
{
37-
"file": match.group("file").lstrip(path_prefix),
37+
"file": match.group("file").removeprefix(path_prefix),
3838
"line": match.group("line"),
3939
"column": match.group("column"),
4040
"message": match.group("message"),
@@ -47,7 +47,7 @@ def extract_warnings_from_compiler_output_clang(
4747

4848
def extract_warnings_from_compiler_output_json(
4949
compiler_output: str,
50-
path_prefix: str | None = None,
50+
path_prefix: str = "",
5151
) -> list[dict]:
5252
"""
5353
Extracts warnings from the compiler output when using
@@ -79,7 +79,7 @@ def extract_warnings_from_compiler_output_json(
7979
{
8080
# Remove leading current
8181
# directory if present
82-
"file": location[key]["file"].lstrip(
82+
"file": location[key]["file"].removeprefix(
8383
path_prefix
8484
),
8585
"line": location[key]["line"],

0 commit comments

Comments
 (0)
0