Skip to content

Use member names to initialize modules#8734

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:module
Feb 6, 2025
Merged

Use member names to initialize modules#8734
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:module

Conversation

@radarhere
Copy link
Copy Markdown
Member

Borrowing an idea from #5201

Rather than creating a struct with the members in order, and adding comments to describe their names,

Pillow/src/_imaging.c

Lines 4440 to 4446 in 2810d7c

static PyModuleDef module_def = {
PyModuleDef_HEAD_INIT,
"_imaging", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
functions, /* m_methods */
};

it seems simpler to just use the member names directly.

static PyModuleDef module_def = {
    PyModuleDef_HEAD_INIT,
    .m_name = "_imaging",
    .m_size = -1,
    .m_methods = functions,
};

@hugovk hugovk merged commit a788ab3 into python-pillow:main Feb 6, 2025
@radarhere radarhere deleted the module branch February 6, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants