8000 gh-107954, PEP 741: Add PyConfig_Get() function by vstinner · Pull Request #123472 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107954, PEP 741: Add PyConfig_Get() function #123472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change SPEC() macro for the visibility
  • Loading branch information
vstinner committed Aug 30, 2024
commit fcf0918b0aa55ce965f793a5d571ce5e0f2c3541
15 changes: 4 additions & 11 deletions Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,15 @@ typedef struct {
PyConfigSysSpec sys;
} PyConfigSpec;

#define SPEC(MEMBER, TYPE, visibility, sys) \
#define SPEC(MEMBER, TYPE, VISIBILITY, sys) \
{#MEMBER, offsetof(PyConfig, MEMBER), \
PyConfig_MEMBER_##TYPE, (visibility), sys}
PyConfig_MEMBER_##TYPE, PyConfig_MEMBER_##VISIBILITY, sys}

#define SYS_ATTR(name) {name, -1, NULL}
#define SYS_FLAG_SETTER(index, setter) {NULL, index, setter}
#define SYS_FLAG(index) SYS_FLAG_SETTER(index, NULL)
#define NO_SYS SYS_ATTR(NULL)

#define INIT_ONLY PyConfig_MEMBER_INIT_ONLY
#define READ_ONLY PyConfig_MEMBER_READ_ONLY
#define PUBLIC PyConfig_MEMBER_PUBLIC

// Update _test_embed_set_config when adding new members
static const PyConfigSpec PYCONFIG_SPEC[] = {
// --- Public options -----------
Expand Down Expand Up @@ -189,9 +185,9 @@ static const PyConfigSpec PYCONFIG_SPEC[] = {
};

#undef SPEC
#define SPEC(MEMBER, TYPE, visibility) \
#define SPEC(MEMBER, TYPE, VISIBILITY) \
{#MEMBER, offsetof(PyPreConfig, MEMBER), PyConfig_MEMBER_##TYPE, \
visibility, NO_SYS}
PyConfig_MEMBER_##VISIBILITY, NO_SYS}

static const PyConfigSpec PYPRECONFIG_SPEC[] = {
// --- Read-only options -----------
Expand Down Expand Up @@ -223,9 +219,6 @@ static const PyConfigSpec PYPRECONFIG_SPEC[] = {
#undef SYS_FLAG_SETTER
#undef SYS_FLAG
#undef NO_SYS
#undef INIT_ONLY
#undef READ_ONLY
#undef PUBLIC


// Forward declarations
Expand Down
0