GeezerVison is showing github.com — gh-158810: Fix Py_ARRAY_LENGTH() macro on C++ by vstinner · Pull Request #158812 · python/cpython
Conversation
vstinner
commented
Oct 4, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I tested manually that the added test fails without the fix with g++ 16.2.1 (on Fedora 44): TestPublicCpp.test_build of test_cext fails in this case. The test pass with the fix.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
I will backport the change to stable branches once the 3.15 branch will be unlocked (next week). I should first backport the test_cext refactoring which merged C and C++ tests in test_cext (remove test_cppext).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot ARM64 macOS 3.x (tier-2) has failed when building commit b2bfbce.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/725/builds/14663) and take a look at the build logs.
- Check if the failure is related to this commit (b2bfbce) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/#/builders/725/builds/14663
Failed tests:
Failed subtests:
- test_build_abi3t - test.test_cext.TestPublicC.test_build_abi3t
- test_build - test.test_cext.TestPublicC.test_build
- test_build_limited - test.test_cext.TestPublicC.test_build_limited
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 127, in test_build_limited
self.check_build('_test_cext_limited', limited=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 134, in test_build_abi3t
self.check_build('_test_cext_abi3t', abi3t=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 114, in test_build
self.check_build('_test_cext')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 134, in test_build_abi3t
self.check_build('_test_cext_abi3t', abi3t=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 114, in test_build
self.check_build('_test_cext')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 127, in test_build_limited
self.check_build('_test_cext_limited', limited=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 101, in check_build
run_cmd('Install', cmd)
~~~~~~~^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_cext/__init__.py", line 81, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/subprocess.py", line 692, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ['/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/env/bin/python.exe', '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', '/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_32288æ/tempcwd/pkg', '-v'] returned non-zero exit status 1.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Hi! The buildbot ARM64 macOS 3.x (tier-2) has failed
Ah, 3 tests build C extensions failed:
ERROR: test_build (test.test_cext.TestPublicC.test_build)
ERROR: test_build_abi3t (test.test_cext.TestPublicC.test_build_abi3t)
ERROR: test_build_limited (test.test_cext.TestPublicC.test_build_limited)
Example of error: extension used: (...) typeof()
gcc -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-strict-overflow -Wsign-compare -g -Og -Wall -I/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/build/test_python_28872æ/tempcwd/env/include -I/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Include -I/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build -c extension.c -o build/temp.macosx-26.6-arm64-cpython-316-pydebug/extension.o -Werror -D_Py_IS_TESTCEXT -Wcast-qual -pedantic-errors -Werror=declaration-after-statement -DMODULE_NAME=_test_cext
extension.c:139:12: error: extension used [-Werror,-Wlanguage-extension-token]
139 | assert(Py_ARRAY_LENGTH(small_array) == 3);
| ^
/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Include/pymacro.h:221:59: note: expanded from macro 'Py_ARRAY_LENGTH'
221 | + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \
| ^
extension.c:139:12: error: extension used [-Werror,-Wlanguage-extension-token]
/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Include/pymacro.h:222:59: note: expanded from macro 'Py_ARRAY_LENGTH'
222 | typeof(&(array)[0]))))
| ^
extension.c:139:12: error: extension used [-Werror,-Wlanguage-extension-token]
/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Include/pymacro.h:221:59: note: expanded from macro 'Py_ARRAY_LENGTH'
221 | + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \
| ^
extension.c:139:12: error: extension used [-Werror,-Wlanguage-extension-token]
/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Include/pymacro.h:222:59: note: expanded from macro 'Py_ARRAY_LENGTH'
222 | typeof(&(array)[0]))))
| ^
4 errors generated.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I wrote PR #158838 to fix the "extension used" error.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
added a commit
that referenced
this pull request
Oct 13, 2026
* gh-158810: Fix Py_ARRAY_LENGTH() macro on C++ (#158812)
(cherry picked from commit b2bfbce)
* gh-158810: Use _Py_TYPEOF in Py_ARRAY_LENGTH() (#158838)
Fix the compiler warning "extension used" when building test_cext
with clang.
* test_cext no longer overrides the CC environment variable if it's
already defined.
* test_cext now also logs __STRICT_ANSI__ macro.
(cherry picked from commit 85c03d4)
* Add Py_SETREF/XSETREF tests to test_cext
vstinner
added a commit
that referenced
this pull request
Oct 13, 2026
* [3.15] gh-158810: Fix Py_ARRAY_LENGTH() macro on C++ (#159315)
* gh-158810: Fix Py_ARRAY_LENGTH() macro on C++ (#158812)
(cherry picked from commit b2bfbce)
* gh-158810: Use _Py_TYPEOF in Py_ARRAY_LENGTH() (#158838)
Fix the compiler warning "extension used" when building test_cext
with clang.
* test_cext no longer overrides the CC environment variable if it's
already defined.
* test_cext now also logs __STRICT_ANSI__ macro.
(cherry picked from commit 85c03d4)
* Add Py_SETREF/XSETREF tests to test_cext
(cherry picked from commit 152185f)
* Backport Py_CLEAR/Py_SETREF/Py_XSETREF from main
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|