File tree Expand file tree Collapse file tree 1 file changed +26
-24
lines changed
Expand file tree Collapse file tree 1 file changed +26
-24
lines changed Original file line number Diff line number Diff line change @@ -411,30 +411,32 @@ module_from_def_and_spec(
411411 for (cur_slot = def_like -> m_slots ; cur_slot && cur_slot -> slot ; cur_slot ++ ) {
412412 // Macro to copy a non-NULL, non-repeatable slot that's unusable with
413413 // PyModuleDef. The destination must be initially NULL.
414- #define COPY_COMMON_SLOT (SLOT , TYPE , DEST ) \
415- if (!(TYPE)(cur_slot->value)) { \
416- PyErr_Format( \
417- PyExc_SystemError, \
418- "module %s: " #SLOT " must not be NULL", \
419- name); \
420- goto error; \
421- } \
422- if (original_def) { \
423- PyErr_Format( \
424- PyExc_SystemError, \
425- "module %s: " #SLOT " used with PyModuleDef", \
426- name); \
427- goto error; \
428- } \
429- if (DEST) { \
430- PyErr_Format( \
431- PyExc_SystemError, \
432- "module %s has more than one " #SLOT " slot", \
433- name); \
434- goto error; \
435- } \
436- DEST = (TYPE)(cur_slot->value); \
437- /////////////////////////////////////////////////////////////
414+ #define COPY_COMMON_SLOT (SLOT , TYPE , DEST ) \
415+ do { \
416+ if (!(TYPE)(cur_slot->value)) { \
417+ PyErr_Format( \
418+ PyExc_SystemError, \
419+ "module %s: " #SLOT " must not be NULL", \
420+ name); \
421+ goto error; \
422+ } \
423+ if (original_def) { \
424+ PyErr_Format( \
425+ PyExc_SystemError, \
426+ "module %s: " #SLOT " used with PyModuleDef", \
427+ name); \
428+ goto error; \
429+ } \
430+ if (DEST) { \
431+ PyErr_Format( \
432+ PyExc_SystemError, \
433+ "module %s has more than one " #SLOT " slot", \
434+ name); \
435+ goto error; \
436+ } \
437+ DEST = (TYPE)(cur_slot->value); \
438+ } while (0); \
439+ /////////////////////////////////////////////////////////////////
438440 switch (cur_slot->slot) {
439441 case Py_mod_create :
440442 if (create ) {
You can’t perform that action at this time.
0 commit comments