This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients AliyevH, aCuria, erlendaasland, petr.viktorin, serhiy.storchaka, vstinner
Date 2022-03-29.12:07:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648555622.26.0.312152327169.issue39355@roundup.psfhosted.org>
In-reply-to
Content
If I build a C++ extension with -std=c++20, I get a compiler error on PyModuleDef_HEAD_INIT:

Modules/_testcppext.cpp:419:5: error: either all initializer clauses should be designated or none of them should be
  419 |     .m_name = "_testcppext",
      |     ^

Code:
---
static struct PyModuleDef module = {
    PyModuleDef_HEAD_INIT,
    .m_name = "_testcppext",
    .m_doc = module_doc,
    ...
};
---

Macro defined as (simplified code):
---
#define PyObject_HEAD_INIT(type) \
    { 1, type },

#define PyModuleDef_HEAD_INIT { \
    PyObject_HEAD_INIT(NULL)    \
    NULL, /* m_init */          \
    0,    /* m_index */         \
    NULL, /* m_copy */          \
  }
---
History
Date User Action Args
2022-03-29 12:07:02vstinnersetrecipients: + vstinner, petr.viktorin, serhiy.storchaka, erlendaasland, aCuria, AliyevH
2022-03-29 12:07:02vstinnersetmessageid: <1648555622.26.0.312152327169.issue39355@roundup.psfhosted.org>
2022-03-29 12:07:02vstinnerlinkissue39355 messages
2022-03-29 12:07:02vstinnercreate