GeezerVison is showing github.com — From CI, Tools/c-analyzer/check-c-globals.py failed · Issue #150948 · python/cpython
From CI, Tools/c-analyzer/check-c-globals.py failed #150948Labels infraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug report
Bug description:
Working from this #130913 PR, I recently needed to add this line #include <sys/sysctl.h> // sysctlbyname in a header file.
From CI, the check-c-globals.py tools failed with this message:
..... ..... /home/runner/work/cpython/cpython/Modules/_multiprocessing/semaphore_macosx.h:5:10: fatal error: sys/sysctl.h: No such file or directory
5 | #include <sys/sysctl.h> // sysctlbyname
| ^~~~~~~~~~~~~~
compilation terminated.
# requested file: </home/runner/work/cpython/cpython/Modules/_multiprocessing/semaphore_macosx.h>
See https://github.com/python/cpython/actions/runs/26958247530/job/79541476456?pr=130913#step:11:39 for complete logs
cc @ericsnowcurrently (As suggested in the documentation:)
CPython versions tested on:
3.16
Operating systems tested on:
macOS
Linked PRs
ActivityStanFromIreland commented on Jun 5, 2026 YvesDup commented on Jun 5, 2026 ContributorAuthor More actions
Occasionally the tool is unable to parse updated code.
If this happens then add the file to the "EXCLUDED" list
in Tools/c-analyzer/cpython/_parser.py and create a new
issue for fixing the tool (and CC ericsnowcurrently
on the issue).
I guess if the PR is approved, this new file will be noted as excluded from the tool run. YvesDup commented on Jun 5, 2026 ContributorAuthor More actions I added in Tools/c-analyzer/cpython/_parser.py the file that raises the error.
# XXX Handle these.
EXCLUDED = format_conf_lines([
# macOS
'Modules/_scproxy.c', # SystemConfiguration/SystemConfiguration.h
'Modules/_multiprocessing/semaphore_macosx.h', # <sys/sysctl.h>
# Windows
I created a new branch with the change into the Tools/c-analyzer/cpython/_parser.py file but the "Check for unsupported C global variables" test is disabled - see https://github.com/YvesDup/cpython/actions/runs/27023166717/job/79756266970 zainnadeem786 commented on Jun 20, 2026 Hi @StanFromIreland @YvesDup ,
I'd like to work on this issue.
I investigated the c-analyzer path and it appears that Modules/_multiprocessing/semaphore_macosx.h is being picked up by the analyzer through the generic Modules/**/*.h scan, but preprocessing fails on non-macOS CI because of the #include <sys/sysctl.h> dependency.
From what I found, the existing approach for files that cannot be parsed cross-platform is to add them to the EXCLUDED list in Tools/c-analyzer/cpython/_parser.py. Similar platform-specific exclusions already exist for _scproxy.c, _winapi.c, and other OS-specific files.
I plan to submit a small PR that adds Modules/_multiprocessing/semaphore_macosx.h to the macOS exclusion list, which appears to be consistent with the current c-analyzer guidance and existing exclusions.
Please let me know if there is a preferred alternative approach. StanFromIreland commented on Jun 20, 2026 I'm sorry but I closed your PR, it is not necessary. Such changes should be done in #130913 instead. zainnadeem786 commented on Jun 20, 2026 YvesDup commented on Jun 21, 2026 Author show commentMore actions StanFromIreland commented on Jun 21, 2026 Sorry @YvesDup, I'm not familiar with macOS things and I don't have access to a machine to test. YvesDup commented on Jun 22, 2026 Author show commentMore actions YvesDup commented on Jun 22, 2026 ContributorAuthor More actions I confirm that this part of code is dedicated to macOS platform. The c-analyzer tool runs on linux where the <sys/sysctl.h> header has been deprecated for some time and no longer exists.
So I think it makes sense to add semaphore_macosx.h into the file Tools/c-analyzer/cpython/_parser.py, as suggested below.
I wish this is the right way to go about it.
This modification will be add to the #130913 PR. YvesDup commented on Jun 22, 2026 ContributorAuthor More actions I will close this issue as completed. No objection ? StanFromIreland commented on Jun 22, 2026 Since we don't need any action here, I agree we can close. YvesDup commented on Jun 22, 2026 ContributorAuthor More actions
MetadataMetadatainfraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DevelopmentNo branches or pull requestsIssue actions
|