Skip to content

gh-150948: Exclude macOS semaphore header from c-analyzer#151777

Closed
zainnadeem786 wants to merge 1 commit into
python:mainfrom
zainnadeem786:fix/check-c-globals-macos-header
Closed

gh-150948: Exclude macOS semaphore header from c-analyzer#151777
zainnadeem786 wants to merge 1 commit into
python:mainfrom
zainnadeem786:fix/check-c-globals-macos-header

Conversation

@zainnadeem786

Copy link
Copy Markdown

Summary

Exclude Modules/_multiprocessing/semaphore_macosx.h from the c-analyzer parser configuration.

Issue

check-c-globals.py scans files matched by Modules/**/*.h. The macOS-specific header Modules/_multiprocessing/semaphore_macosx.h includes:

#include <sys/sysctl.h>

This header is not available on non-macOS CI environments, causing preprocessing to fail before the analyzer can inspect the file.

As a result, the "Check for unsupported C global variables" job can fail due to a platform-specific dependency rather than an actual c-analyzer issue.

Fix

Add Modules/_multiprocessing/semaphore_macosx.h to the EXCLUDED list in Tools/c-analyzer/cpython/_parser.py.

This follows the existing pattern used for other platform-specific files that cannot be parsed reliably across all CI platforms, such as:

  • Modules/_scproxy.c
  • Modules/_winapi.c
  • platform-specific dynload implementations

Rationale

The current c-analyzer workflow already relies on explicit exclusions for files that depend on OS-specific headers unavailable on other platforms.

Since semaphore_macosx.h depends on the macOS-only sys/sysctl.h header, excluding it is consistent with the existing policy and avoids unrelated CI failures.

Fixes gh-150948.

@bedevere-app

bedevere-app Bot commented Jun 20, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@StanFromIreland

Copy link
Copy Markdown
Member

I'm sorry but I'm closing. This file does not exist, it is being considered as part of #130913. If we decide to merge that PR, we can add the exclusion there, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

From CI, Tools/c-analyzer/check-c-globals.py failed

2 participants