Skip to content

Commit 7806d52

Browse files
committed
+1
1 parent 1d41358 commit 7806d52

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Modules/_struct.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -856,14 +856,22 @@ np_double_complex(_structmodulestate *state, char *p, PyObject *v,
856856
}
857857
#else
858858
static int
859-
complex_format_stub(_structmodulestate *state, char *p, PyObject *v,
860-
const formatdef *f)
859+
np_complex_stub(_structmodulestate *state, char *p, PyObject *v,
860+
const formatdef *f)
861861
{
862862
PyErr_Format(state->StructError,
863863
"'%c' format not supported on this system",
864864
f->format);
865865
return -1;
866866
}
867+
static PyObject *
868+
nu_complex_stub(_structmodulestate *state, const char *p, const formatdef *f)
869+
{
870+
PyErr_Format(state->StructError,
871+
"'%c' format not supported on this system",
872+
f->format);
873+
return NULL;
874+
}
867875
#endif
868876

869877
static int
@@ -908,8 +916,8 @@ static const formatdef native_table[] = {
908916
{'E', sizeof(float complex), FLOAT_COMPLEX_ALIGN, nu_float_complex, np_float_complex},
909917
{'C', sizeof(double complex), DOUBLE_COMPLEX_ALIGN, nu_double_complex, np_double_complex},
910918
#else
911-
{'E', 1, 0, complex_format_stub, complex_format_stub},
912-
{'C', 1, 0, complex_format_stub, complex_format_stub},
919+
{'E', 1, 0, nu_complex_stub, np_complex_stub},
920+
{'C', 1, 0, nu_complex_stub, np_complex_stub},
913921
#endif
914922
{'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p},
915923
{0}
@@ -1250,8 +1258,8 @@ static formatdef bigendian_table[] = {
12501258
{'E', 8, 0, bu_float_complex, bp_float_complex},
12511259
{'C', 16, 0, bu_double_complex, bp_double_complex},
12521260
#else
1253-
{'E', 1, 0, complex_format_stub, complex_format_stub},
1254-
{'C', 1, 0, complex_format_stub, complex_format_stub},
1261+
{'E', 1, 0, nu_complex_stub, np_complex_stub},
1262+
{'C', 1, 0, nu_complex_stub, np_complex_stub},
12551263
#endif
12561264
{0}
12571265
};
@@ -1576,8 +1584,8 @@ static formatdef lilendian_table[] = {
15761584
{'E', 8, 0, lu_float_complex, lp_float_complex},
15771585
{'C', 16, 0, lu_double_complex, lp_double_complex},
15781586
#else
1579-
{'E', 1, 0, complex_format_stub, complex_format_stub},
1580-
{'C', 1, 0, complex_format_stub, complex_format_stub},
1587+
{'E', 1, 0, nu_complex_stub, np_complex_stub},
1588+
{'C', 1, 0, nu_complex_stub, np_complex_stub},
15811589
#endif
15821590
{0}
15831591
};

0 commit comments

Comments
 (0)