Skip to content

Commit 4c53701

Browse files
authored
Avoid Py_ARRAY_LENGTH() (#134)
Replace Py_ARRAY_LENGTH(array) with sizeof(array)/sizeof(array[0]). Py_ARRAY_LENGTH() fails with C++ on Python 3.9 on macOS.
1 parent d341dac commit 4c53701

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pythoncapi_compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ PyConfig_Get(const char *name)
20922092

20932093
const PyConfigSpec *spec;
20942094
int found = 0;
2095-
for (size_t i=0; i < Py_ARRAY_LENGTH(config_spec); i++) {
2095+
for (size_t i=0; i < sizeof(config_spec) / sizeof(config_spec[0]); i++) {
20962096
spec = &config_spec[i];
20972097
if (strcmp(spec->name, name) == 0) {
20982098
found = 1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy